%pylab inline
import pandas as pd
import numpy as np
import matplotlib as mpl
import seaborn as sns
typessns = pd.DataFrame.from_csv('C:/data/testesns.csv', index_col=False, sep=';')
mpl.rc("figure", figsize=(45, 10))
sns.factorplot("MONTH", "VALUE", hue="REGION", data=typessns, kind="box", palette="OrRd");
I always get a small size figure, no matter what size I 've specified in figsize... How to fix it?
mpl.rc
is stored in a global dictionary (see http://matplotlib.org/users/customizing.html). So, if you only want to change the size of one figure (locally), it will do the trick:It worked for me using
matplotlib-1.4.3
andseaborn-0.5.1
%pylab inline
, it is deprecated, use%matplotlib inline
.set_style
function, pass it your rc as second parameter or kwarg.: http://web.stanford.edu/~mwaskom/software/seaborn/generated/seaborn.set_style.htmlIf you just want to scale the figure use the below code:
The size of the figure is controlled by the
size
andaspect
arguments tofactorplot
. They correspond to the size of each facet ("size
" really means "height" and thensize * aspect
gives the width), so if you are aiming for a particularl size for the whole figure you'll need to work backwards from there.To be a little more concrete:
You want to pass in the arguments 'size' or 'aspect' to the sns.factorplot() when constructing your plot.
Size will change the height, while maintaining the aspect ratio (so it will also also get wider if only size is changed.)
Aspect will change the width while keeping the height constant.
The above code should be able to be run locally in an ipython notebook.
Plot sizes are reduced in these examples to show the effects, and because the plots from the above code were fairly large when saved as png's. This also shows that size/aspect includes the legend in the margin.
size=2, aspect=1
size=4, aspect=1
size=4, aspect=2
Also, all other useful parameters/arguments and defaults for this plotting function can be viewed with once the 'sns' module is loaded: