![tikzplotlib 中的独立 Tikz 无法编译](https://linux22.com/image/424070/tikzplotlib%20%E4%B8%AD%E7%9A%84%E7%8B%AC%E7%AB%8B%20Tikz%20%E6%97%A0%E6%B3%95%E7%BC%96%E8%AF%91.png)
我正在尝试使用 tikzplotlib 编译从 matplotlib python 图导出的以下独立 tikz 图片。它最初有超过 4000 个数据点,我认为它可能与此有关,但删除其中大部分数据点并没有改变任何东西。我当前的 TexStudio 选项设置为pdflatex.exe -shell-escape -synctex=1 -interaction=nonstopmode %.tex
,我得到的错误是:
Missing } inserted. \end{axis}
Missing } inserted. \end{axis}
Missing } inserted. \end{axis}
Package tikz Error: Giving up on this path. Did you forget a semicolon?. \end{axis}
Extra }, or forgotten \endgroup. \end{axis}
Missing } inserted. \end{axis}
Extra }, or forgotten \endgroup. \end{axis}
Missing } inserted. \end{axis}
Extra }, or forgotten \endgroup. \end{axis}
Extra }, or forgotten \endgroup. \end{axis}
Missing } inserted. \end{axis}
Missing } inserted. \end{axis}
Extra }, or forgotten \endgroup. \end{tikzpicture}
Missing } inserted. \end{tikzpicture}
Extra }, or forgotten \endgroup. \end{tikzpicture}
Missing } inserted. \end{tikzpicture}
Extra }, or forgotten \endgroup. \end{tikzpicture}
Improper \prevdepth. \end{tikzpicture}
Missing \endgroup inserted. \end{tikzpicture}
Missing } inserted. \end{tikzpicture}
the current plot has no coordinates (or all have been filtered away)
the current plot has no coordinates (or all have been filtered away)
the current plot has no coordinates (or all have been filtered away)
该文件如下所示:
\documentclass[tikz]{standalone}
\usepackage[utf8]{inputenc}
%\usetikzlibrary{matrix,calc,shapes,arrows.meta,chains}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
% This file was created by tikzplotlib v0.9.4.
\begin{tikzpicture}
\begin{axis}[
legend cell align={left},
legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=white!80!black},
tick align=outside,
tick pos=left,
x grid style={white!69.0196078431373!black},
xlabel={runtime},
xmin=-21.78865, xmax=493.66365,
xtick style={color=black},
y grid style={white!69.0196078431373!black},
ylabel={realsum},
ymin=40062.76, ymax=210447.04,
ytick style={color=black}
]
\addplot [only marks, mark=*, draw=white, fill=white!75.2941176470588!black, colormap/viridis, forget plot]
table{%
x y
5.343 178904
36.249 111280.1
15.408 116577.6
19.829 96333.3
1.92 177480.8
62.921 96105.7
3.629 160828.6
56.141 109809
6.374 107856.8
50.562 96579.8
7.344 169063.7
44.529 104101.9
14.265 110733.9
26.702 93951.6
10.736 192417.5
109.734 118327.8
10.314 148391.3
88 102395.1
6.72 133887.6
82.218 117045.1
8.702 166363.5
31.297 96127.7
11.889 138228.8
21.421 113204.8
3.286 193060.4
60.342 109896.8
4.403 161075.7
60.017 110284.9
7.388 107470.9
49.079 95917.6
6.702 151490.9
39.797 85394.5
16.841 114251.2
19.968 96359.1
2.888 196647.5
59.876 110170.9
4.407 152544.6
62.281 95858.1
5.125 131297.6
53.313 111019.5
6.188 165340.3
38.327 95750.9
10.058 133818
18.875 111274
2.377 170262.4
67.517 84013.3
3.621 137730.1
66.108 84102.4
4.706 131388.5
51.936 109948.6
4.17 158531.8
36.75 87789.1
13.018 88319.2
24.204 69131.1
2.208 163462.5
59.156 72404.3
3.941 123789.1
52.766 66915.8
3.749 103882.6
46.625 86194.8
6.02 149750.1
16.529 95276.8
28.123 79030.5
2.234 171477.8
3.951 137884.9
74.938 94466.4
6.641 92738.2
63.968 84964.9
5.5 148785.1
49.811 81232.5
12.762 101769.6
27.704 79641.6
2.42 172851.9
73.781 91497.7
3.941 136970
75.313 92813.1
5.671 85936.7
71.657 69466.3
3.766 158678.4
38.22 86517
12.611 91744.8
27.42 94709
2.311 175502.9
71.53 87648.2
3.346 129020.9
69.345 74570.2
5.579 84816.4
5.095 147701.6
36.563 86892
7.092 115384.1
24.124 96328.8
2.422 174374.9
70.313 86764.8
3.937 123321.3
69.75 69681.6
7.687 92690.8
65.094 74613.6
10.686 131328.4
37.783 64066.9
14.798 74370.3
22.157 64229
1.789 151432.4
49.328 62859.7
4.252 110033.7
44.657 62782.9
9.015 64516.8
43.78 63109.2
12.08 131105.1
41.515 71267.5
14.076 80808
27.17 72962.4
2.344 152229.2
95.799 72900.7
4.246 111841.3
91.156 71052.4
9.988 71025.8
66.643 70888.3
9.654 129551.7
38.47 65009.7
14.843 78930.3
23.924 65744.7
1.979 151606
56.092 67365.3
4.077 110217.6
61 65442.5
8.792 69723.3
52.672 66347
10.991 129922
42.171 64166.5
15.364 74598.2
17.639 64359.6
2.107 151856
51.203 64431.2
4.072 110777.8
45.718 64517.7
9.467 64422.6
42.718 64352.8
7.984 130963.5
36.25 64215.1
13.907 74287.8
20.735 64250.7
1.921 151622.6
51.03 64146.9
3.79 110630.3
46.156 64184.8
10.609 64423.6
41.797 64351
9.64 120246
38.954 49026.3
17.501 64962.1
17.202 50276.2
2.75 140314.4
50.986 47807.5
3.487 97835.3
48.704 48735.6
8.843 58172.9
44.939 49286.9
54.36 59887.5
15.406 69601.3
31.438 61774.5
2.644 141789.2
3.825 101958.7
104.984 59882.4
72.624 60840.7
9.668 120424.7
53.374 53755.2
14.378 66518.9
2.077 140786.9
71.579 54573.3
3.56 100846.3
61.436 55052.6
13.438 120423.9
51.656 50559.1
21.546 51296.6
1.855 140744.8
69.673 49555.3
4.168 100532.1
73.734 50082.7
64.938 51577
10.391 120152.9
40 50799.6
20.953 51373
2.09 140224.1
57.484 48960.3
4.19 101050.2
58.171 53320.7
47.454 49540.5
12.516 145374.7
54.062 84815.9
16.954 100843.6
30.736 85095.1
2.967 183566.5
86.686 112620.5
5.017 156999.5
75.061 113684.6
8.002 125468.2
71.171 115398.7
7.765 173789.1
53.061 120127.3
16.673 135653.4
30.75 120339.3
3.23 182778.9
91.561 118134
4.622 136859.9
111.093 107277.9
9.42 126950
72.156 118798.4
9.58 145193.6
14.722 134310.4
28.893 115481.7
2.533 161442.9
79.406 86168.6
4.688 123516.8
74.968 85514.1
7.36 93635.1
62.374 87139.1
8.751 155295.5
56.485 96856.4
14.892 133876.4
26.811 115166.7
2.244 161850.4
76.313 83979.2
6.628 159945
83.547 111402
8.689 104691.7
54.531 94375.7
10.376 158081
53.953 96992
17.41 132879.7
28.313 115133.5
3.372 183708.9
86.845 113845.9
6.214 155185.7
79.345 111874.3
8.353 105550.5
59.217 94599
6.371 153249.2
59.344 86750.8
16.856 110914.2
32.874 93089.3
3.482 164461.4
82.42 85861.2
3.842 110009.8
55.795 64958.8
7.114 101302.5
61.954 89339.5
7.545 154466.5
76.44 96848.2
12.964 112069.1
41.234 97894.3
3.367 165032.6
110.251 95149.5
4.403 112568.9
112.5 80438
7.029 80362.7
100.251 80294.7
9.296 130211.1
15.436 85504.2
3.369 154978.1
82.374 76983.2
4.874 114535.6
78.219 81005.2
7.45 104005.1
87.219 95394.5
10.093 141441.5
54.015 91370.8
17.265 85261.8
32.921 92147.4
2.629 148563.2
75.545 70167.6
4.082 110079.6
79.079 74309.5
7.876 102420.5
89.515 92223.9
8.472 138955.2
40.485 73011
17.97 97246.5
28.39 76707.9
3.173 156073.3
67.732 78762.9
4.86 115524.8
71.017 78382.9
8.687 84879.7
63.438 78112.6
5.018 147978.5
6.658 162200
4.688 139261.5
13.314 102010.8
12.746 102799.6
10.751 93181.3
1.846 181264.1
1.984000001 170576.9
1.848 181693.7
3.734 142243.5
3.188 131713.5
4.282 154009.7
9.126 110172.5
5.578 87493
7.626 98770.2
6.985 149219
4.936 140474
7.674 162648
16.017 123769.2
16.168 102129.4
14.015 124022.1
6.75 170341.7
3.564 161879.3
6.284 170457.8
6.705 156986.3
4.419 132722.4
5.862 157156.6
13.617 103279.3
11.877000001 102693.9
11.435 103045.6
5.888 141833
5.093 139731
5.075 140498
10.311 99334.2
8.514 97670
10.814 118785.2
2.44 170330.7
2.465 180910.1
2.333 161572.5
3.44 139442.6
3.828 133348.5
3.925 133468.5
6.675 98967.5
10.987 112059.6
4.903 92830.6
5.359 147567
4.748999999 139344
4.515 140193
9.78 95096.3
12.563 103473.8
11.799 115848.4
2.213 181367.4
2.004 169697.8
1.983999999 161228.2
3.677 141739
3.183 133648.5
3.347 133020.5
8.126 109170.3
7.158 95993.6
7.798 96359.3
5.236 141535.5
5.5 148427.5
4.153 147686.5
14.111 103112.1
15.315 117153.9
12.545 102504
2.066 181537.9
2.065 169697.3
1.938 181775.6
3.636 132065.5
3.251 132608.5
3.686 135296
8.66 98301.3
7.266 109991
7.736 109893.2
4.157 151880.5
14.291 115053.5
1.809 196030
3.66 169604
7.917 94670
5.407 161468.5
12.064 124193.5
1.832 182299.5
3.089 142398
7.609 103654
4.894 151763.5
10.49 131129.5
1.715 195695
3.937 166419
11.716999999 110808
4.091 152054
12.593 114480.5
1.751 195764
3.42 144178.5
6.315 95598
};
\addplot [only marks, mark=*, draw=black, fill=black, colormap/viridis]
table{%
x y
};
\addlegendentry{0}
\addplot [only marks, mark=*, draw=white!41.1764705882353!black, fill=white!41.1764705882353!black, colormap/viridis]
table{%
x y
};
\addlegendentry{1}
\addplot [only marks, mark=*, draw=white!75.2941176470588!black, fill=white!75.2941176470588!black, colormap/viridis]
table{%
x y
};
\addlegendentry{2}
\end{axis}
\end{tikzpicture}
\end{document}
我的实际目标是将这个图形包含到一篇文章中,如果我将 tikz 代码作为简单*.tex
文件调用,就会出现内存过剩错误。接下来我尝试了外部化,但由于某种原因,它似乎不起作用(我尝试了 tex.se 上的几乎所有建议)。所以我的最后一根稻草是独立编译,然后将其加载到主文档中。但我觉得错误是在 tikz 代码本身的某个地方,我用 将其从 python 中导出tikzplotlib
。
我很感激任何建议!