How do I change the size of my image so it's suitable for printing?
For example, I'd like to use to A4 paper, whose dimensions are 11.7 inches by 8.27 inches in landscape orientation.
How do I change the size of my image so it's suitable for printing?
For example, I'd like to use to A4 paper, whose dimensions are 11.7 inches by 8.27 inches in landscape orientation.
You can set the context to be
poster
or manually setfig_size
.Note that if you are trying to pass to a "figure level" method in seaborn (for example
lmplot
,catplot
/factorplot
,jointplot
) you can and should specify this within the arguments usingheight
andaspect
.See https://github.com/mwaskom/seaborn/issues/488 and Plotting with seaborn using the matplotlib object-oriented interface for more details on the fact that figure level methods do not obey axes specifications.
For my plot (a sns factorplot) the proposed answer didn't works fine.
Thus I use
Just after the plot with seaborn (so no need to pass an ax to seaborn or to change the rc settings).
first import matplotlib and use it to set the size of the figure
The top answers by Paul H and J. Li do not work for all types of seaborn figures. For the
FacetGrid
type (for instancesns.lmplot()
), use thesize
andaspect
parameter.Size
changes both the height and width, maintaining the aspect ratio.Aspect
only changes the width, keeping the height constant.You can always get your desired size by playing with these two parameters.
Credit: https://stackoverflow.com/a/28765059/3901029
You need to create the matplotlib Figure and Axes objects ahead of time, specifying how big the figure is: