# Matplotlib PGF Export: Error Dimension too large

I have an issue I could not find any other threads on, only for people who create their pgf plot manually. I have created a boxplot using matplotlib and Seaborn. I want to export this plot to TeX, so I can include it natively in my thesis.

I've first tried using the matplotlib pgf export. While this has worked for me in many cases, this time, it didn't. I get various errors:

img/exampleplot.pgf|1000 error| Dimension too large. img/exampleplot.pgf|1001 error| Dimension too large. img/exampleplot.pgf|1002 error| Dimension too large. img/exampleplot.pgf|1003 error| Dimension too large. img/exampleplot.pgf|1018 error| Dimension too large. img/exampleplot.pgf|1019 error| Dimension too large. img/exampleplot.pgf|1020 error| Dimension too large. img/exampleplot.pgf|1021 error| Dimension too large. img/exampleplot.pgf|1036 error| Dimension too large. img/exampleplot.pgf|1037 error| Dimension too large. img/exampleplot.pgf|1038 error| Dimension too large. img/exampleplot.pgf|1039 error| Dimension too large. img/exampleplot.pgf|1054 error| Dimension too large. img/exampleplot.pgf|1055 error| Dimension too large. img/exampleplot.pgf|1056 error| Dimension too large. img/exampleplot.pgf|1057 error| Dimension too large.

You can find the pgf code at the end of this post. The only thing I've noticed is that other people had similar issues when using log scale boxplots (I am using log scale boxplots as well).

Then, I've tried tikzplotlib, but the plot genereted by it misses the x-ticks and all labels that are there when using the matplotlib pdf export

Tikzplotlib Result:

How it should look like (don't mind the rotation, this is fine):

So I am lost on how to continue here. Any help on how to either fix the matplotlib pgf export or the tikzplotlib result would be appreciated.

Here is the matplotlib pgf source: https://pastebin.com/JH7ZCvrb

• If you want anyone to look at the code from tikzplotlib, please provide that code. Jul 5 '20 at 12:05

## 1 Answer

Round about line 1000 of the .pgf file, you have four instances where things are drawn at a coordinate of (1.004445in, -2250.839168in), I'm guessing 2250 inches is more than TeX can handle.

Try commenting out everything from the \begin{pgfscope} at line 989 to the \end{pgfscope} at line 1060, and check if the output is as it should be. I get