Reputation: 9451
I've been using the underying matplot lib library to make adjustments that ggplot does not allow me to.
p = ggplot(aes(x='meh',y='mah'),data=df)
t = theme_gray()
t._rcParams['font.size'] = 30
t._rcParams['xtick.labelsize'] = 20
t._rcParams['ytick.labelsize'] = 20
p = p + t
This works as expected. I now wish to increase the size of the legend, which I am creating via adding the color
argument:
p = ggplot(aes(x='meh',y'mah',color='week'),data=df)
From here, I can see the following argument for editing the legend:
t._rcParams['legend.fontsize'] = 20
Despite there being no errors, this does not doing anything to the legend text size.
Upvotes: 1
Views: 1718
Reputation: 4060
After making several tests, it looks like legend font size is actually controlled by the parameter font.size
. And it also looks like xaxis and yaxis legend font size cannot controlled independently.
(In the image below, the legend that is color
argument is for illustration purpose only)
from ggplot import *
p = ggplot(aes(x='date', y='beef', color='beef'), data=meat) + geom_line()
t = theme_gray()
t._rcParams['font.size'] = 40 # Legend font size
t._rcParams['xtick.labelsize'] = 20 # xaxis tick label size
t._rcParams['ytick.labelsize'] = 30 # yaxis tick label size
t._rcParams['axes.labelsize'] = 30 # axis label size
p + t
Upvotes: 3