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

Skip to content

Commit 00ec9bf

Browse files
committed
DOC: tweak showcase example
1 parent 9158c69 commit 00ec9bf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

examples/showcase/bachelors_degrees_by_gender.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
ax.get_xaxis().tick_bottom()
2828
ax.get_yaxis().tick_left()
2929

30+
fig.subplots_adjust(left=.06, right=.75, bottom=.02, top=.94)
3031
# Limit the range of the plot to only where the data is.
3132
# Avoid unnecessary whitespace.
32-
plt.xlim(1968.5, 2011.1)
33-
plt.ylim(-0.25, 90)
33+
ax.set_xlim(1968.5, 2011.1)
34+
ax.set_ylim(-0.25, 90)
35+
ax.get_xaxis().get_major_formatter().set_useOffset(False)
3436

3537
# Make sure your axis ticks are large enough to be easily read.
3638
# You don't want your viewers squinting to read your plot.
@@ -91,10 +93,10 @@
9193

9294
# Note that if the title is descriptive enough, it is unnecessary to include
9395
# axis labels; they are self-evident, in this plot's case.
94-
plt.title('Percentage of Bachelor\'s degrees conferred to women in '
96+
fig.suptitle('Percentage of Bachelor\'s degrees conferred to women in '
9597
'the U.S.A. by major (1970-2011)\n', fontsize=18, ha='center')
9698

9799
# Finally, save the figure as a PNG.
98100
# You can also save it as a PDF, JPEG, etc.
99101
# Just change the file extension in this call.
100-
plt.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight')
102+
# plt.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight')

0 commit comments

Comments
 (0)