Skip to content
Advertisement

Export huge seaborn chart into pdf with multiple pages

I created a program which generates a large number of chart using seaborn catplot. This is the example of my code with the illustration of how the final chart looks like.

JavaScript

Image taken from https://seaborn.pydata.org/tutorial/axis_grids.html

However since the plot may extend up to more than 300 plots, when I tried to export to pdf, the size of the chart is too big and big part of the plot get cropped out. I notice there are only 1 pages for this pdf output. Is there a way to create a multiple pages for this output?

EDIT:

As suggested by comments, I’m trying to use PdfPages

JavaScript

But it return error message:

JavaScript

and return with pdf document with blank pages inside. Please help as I may not aware which part I did it wrongly

Advertisement

Answer

I think you will have to split your plot in several figures so as to use the answer provided by @r-beginners

If you use catplot() you can use col_order= to specify which subject to show. You can loop through chunk of subjects using itertools.

Something like this:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement