|
27 | 27 | ax.get_xaxis().tick_bottom()
|
28 | 28 | ax.get_yaxis().tick_left()
|
29 | 29 |
|
| 30 | +fig.subplots_adjust(left=.06, right=.75, bottom=.02, top=.94) |
30 | 31 | # Limit the range of the plot to only where the data is.
|
31 | 32 | # 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) |
34 | 36 |
|
35 | 37 | # Make sure your axis ticks are large enough to be easily read.
|
36 | 38 | # You don't want your viewers squinting to read your plot.
|
|
91 | 93 |
|
92 | 94 | # Note that if the title is descriptive enough, it is unnecessary to include
|
93 | 95 | # 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 ' |
95 | 97 | 'the U.S.A. by major (1970-2011)\n', fontsize=18, ha='center')
|
96 | 98 |
|
97 | 99 | # Finally, save the figure as a PNG.
|
98 | 100 | # You can also save it as a PDF, JPEG, etc.
|
99 | 101 | # 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