collarblind
collarblind

Reputation: 4739

pandas subplot title size in ipython notebook

I plotted two plots side by side in an ipython notebook cell. But, I am having trouble changing the size of the title. I can change the size of the labels by adding the argument fontsize = 20. How do I change the title for df and df2.

fig, axes = plt.subplots(ncols=2, figsize = (20,10))
df.plot('barh', title = 'Legal Collectible Answer Distribution', fontsize = 20, ax = axes[0])
df2.plot(kind = 'pie', autopct = '%1.0f%%', legend = False, title = 'Legal Collectible Answer Distribution', fontsize = 20, ax =axes[1])

Upvotes: 14

Views: 21077

Answers (2)

Brad Miller
Brad Miller

Reputation: 124

Try breaking out the title property onto its own, something like this should work:

df.plot.title('Legal Collectible Answer Distribution', fontsize=20)
df2.plot.title('Legal Collectible Answer Distribution', fontsize=20)

and remove title from the plot commands, not sure why it's not working in line, but in a quick test it doesn't work inline for me either.

Upvotes: -1

tmdavison
tmdavison

Reputation: 69076

You can change the size of an existing title on the Axes using title.set_size()

axes[0].title.set_size(40)

Upvotes: 24

Related Questions