diff --git a/examples/showcase/bachelors_degrees_by_gender.py b/examples/showcase/bachelors_degrees_by_gender.py index 737c37dd8f5..fb5132cc422 100644 --- a/examples/showcase/bachelors_degrees_by_gender.py +++ b/examples/showcase/bachelors_degrees_by_gender.py @@ -30,22 +30,20 @@ fig.subplots_adjust(left=.06, right=.75, bottom=.02, top=.94) # Limit the range of the plot to only where the data is. # Avoid unnecessary whitespace. -ax.set_xlim(1968.5, 2011.1) +ax.set_xlim(1969.5, 2011.1) ax.set_ylim(-0.25, 90) -ax.get_xaxis().get_major_formatter().set_useOffset(False) # Make sure your axis ticks are large enough to be easily read. # You don't want your viewers squinting to read your plot. plt.xticks(range(1970, 2011, 10), fontsize=14) -plt.yticks(range(0, 91, 10), ['{0}%'.format(x) - for x in range(0, 91, 10)], fontsize=14) +plt.yticks(range(0, 91, 10), fontsize=14) +ax.xaxis.set_major_formatter(plt.FuncFormatter('{:.0f}'.format)) +ax.yaxis.set_major_formatter(plt.FuncFormatter('{:.0f}%'.format)) # Provide tick lines across the plot to help your viewers trace along # the axis ticks. Make sure that the lines are light and small so they # don't obscure the primary data lines. -for y in range(10, 91, 10): - plt.plot(range(1969, 2012), [y] * len(range(1969, 2012)), '--', - lw=0.5, color='black', alpha=0.3) +plt.grid(True, 'major', 'y', ls='--', lw=.5, c='k', alpha=.3) # Remove the tick marks; they are unnecessary with the tick lines we just # plotted. @@ -100,3 +98,4 @@ # You can also save it as a PDF, JPEG, etc. # Just change the file extension in this call. # plt.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight') +plt.show()