Closed
Description
I have some data that I have used to generate a stacked bar graph.
by_conclusion = measles_data.groupby(["AGE", "CONCLUSION"])
counts_by_cause = by_conclusion.size().unstack().fillna(0)
ax = counts_by_cause.plot(kind='bar', stacked=True)
However, I get a pretty crowded x-axis:
So, I try to use set_xticks
to try and thin them out, either as an argument to plot, or as a separate command:
ax.xticks(arange(0,80,10))
However, for some reason, the labels end up being downscaled by a factor of 10:
(might be hard to see, but it is printing "0.0, 1.0, 2.0, ..." instead of "0, 10, 20, ...")
Its not clear why this is happening, or how to get around it, so I'm either going about this wrong or its a bug. I get the same behavior when I try using MaxNLocator
:
ax.xaxis.set_major_locator( MaxNLocator(nbins = 7) )