Matplotlib PGF 导出:错误尺寸太大

Matplotlib PGF 导出:错误尺寸太大

我遇到了一个问题,我找不到其他相关主题,只有那些手动创建 pgf 图的人才能找到。我使用 matplotlib 和 Seaborn 创建了一个箱线图。我想将此图导出到 TeX,这样我就可以将其原生包含在我的论文中。

我首先尝试使用 matplotlib pgf 导出。虽然这在很多情况下对我来说都有效,但这次却不行。我收到各种错误:

img/exampleplot.pgf|1000 错误| 尺寸太大。img/exampleplot.pgf|1001 错误| 尺寸太大。img/exampleplot.pgf|1002 错误| 尺寸太大。img/exampleplot.pgf|1003 错误| 尺寸太大。img/exampleplot.pgf|1018 错误| 尺寸太大。img/exampleplot.pgf|1019 错误| 尺寸太大。img/exampleplot.pgf|1020 错误| 尺寸太大。img/exampleplot.pgf|1021 错误| 尺寸太大。img/exampleplot.pgf|1036 错误| 尺寸太大。img/exampleplot.pgf|1037 错误| 尺寸太大。img/exampleplot.pgf|1038 错误| 尺寸太大。img/exampleplot.pgf|1039 错误|尺寸太大。img/exampleplot.pgf|1054 错误| 尺寸太大。img/exampleplot.pgf|1055 错误| 尺寸太大。img/exampleplot.pgf|1056 错误| 尺寸太大。img/exampleplot.pgf|1057 错误| 尺寸太大。

您可以在本文末尾找到 pgf 代码。我唯一注意到的是,其他人在使用对数刻度箱线图时也遇到了类似的问题(我也在使用对数刻度箱线图)。

然后,我尝试了 tikzplotlib,但它生成的图缺少使用 matplotlib pdf 导出时存在的 x-ticks 和所有标签

Tikzplotlib 结果: 在此处输入图片描述

它看起来应该是什么样的(不要介意旋转,这样就可以了): 在此处输入图片描述

所以我不知道如何继续。任何有关如何修复 matplotlib pgf 导出或 tikzplotlib 结果的帮助都将不胜感激。

这是 matplotlib pgf 源代码:https://pastebin.com/JH7ZCvrb

答案1

在文件的第 1000 行左右.pgf,有四个实例在坐标 (1.004445in, -2250.839168in) 处绘制事物,我猜 2250 英寸超过了 TeX 可以处理的范围。

尝试注释掉从\begin{pgfscope}第 989 行到\end{pgfscope}第 1060 行的所有内容,并检查输出是否符合要求。我得到了

在此处输入图片描述

相关内容