Axis tick tags are truncated using pandas / matplotlib plot
I am using pandas (matplotlib in background) to generate some kind of bar graph.
I do it something like this:
output = StringIO.StringIO()
plot_canvas = matplotlib.pyplot.figure()
ax = plot_canvas.add_subplot(1, 1, 1)
series = df[key].value_counts()[:nums]
fig = series.plot(ax=ax, kind="bar", colormap="Blues",
legend=False,
stacked=False,
title="Numbers of %s" % key,
grid=True).get_figure()
fig.savefig(output, format="png")
o_data = output.getvalue()
output.close()
image_data = o_data.encode("base64")
image_uri = 'data:image/png;base64,%s' % image_data
My problem is that the X data is names (strings) which are quite long and which with these default settings are truncated into PNG. So I am wondering how I can move the graph in the graph to get more free space left without the graph.
You can see the lines on the X axis are being truncated.
+3
source to share