Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc268e2

Browse files
authored
Merge pull request matplotlib#8985 from dstansby/tight-layout
DOC: Add tight_layout to some examples
2 parents 6179526 + e75fd30 commit fc268e2

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

examples/images_contours_and_fields/contour_image.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,5 @@
103103
plt.title("Origin from rc, reversed y-axis")
104104
plt.colorbar(im)
105105

106+
plt.tight_layout()
106107
plt.show()

examples/images_contours_and_fields/pcolor_demo.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@
7878
ax.set_title('pcolorfast')
7979
fig.colorbar(c, ax=ax)
8080

81-
fig.subplots_adjust(wspace=0.5, hspace=0.5)
82-
81+
fig.tight_layout()
8382
plt.show()
8483

8584

examples/scales/log_demo.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
# Create figure
1616
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)
1717

18-
# Note hspace is the amount of height reserved for white space between subplots
19-
# expressed as a fraction of the average axis height
20-
fig.subplots_adjust(hspace=0.5)
21-
2218
# log y axis
2319
ax1.semilogy(t, np.exp(-t / 5.0))
2420
ax1.set(title='semilogy')
@@ -46,4 +42,5 @@
4642
# ylim must be set after errorbar to allow errorbar to autoscale limits
4743
ax4.set_ylim(ymin=0.1)
4844

45+
fig.tight_layout()
4946
plt.show()

0 commit comments

Comments
 (0)