外部化 pgfplots 时使用 -shell-escape 的问题

外部化 pgfplots 时使用 -shell-escape 的问题

我现在尝试了所有可能的方法,但我仍然不明白为什么这个选项有时有效,有时无效,以及我能做些什么。我想用 pgfplots 绘制一个图形,但由于它需要太多内存,我读到可以将 pgfplot 外部化。我尝试使用 cmd 并输入 来生成一个 pdf 文件pdflatex -shell-escape myfile.tex。对于较小的图形,它可以工作,但对于较大的图形,我收到消息:

Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-
on-error -interaction=batchmode -jobname "A-n53-k7_radius1,5_50_figure0" 
"\def\tikz\externalrealjob{A-n53-k7_radius1,5_50}\input{A-
n53-k7_radius1,5_50}"` did NOT result in a usable output file (...) 

If you continue now, I'll try to typeset the picture.

如果我只是输入“Enter”,我就会收到错误:

Package pgfkeys Error: I do not know the key `/tikz/5`and I am going to ignore it. 
Perhaps you misspelled it.

有人能帮忙吗?该文件的一个最小示例是:

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage[onehalfspacing]{setspace}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{pgfplots}
\usepackage{xcolor}
\usepackage{color}
\usepackage{tikz}
\tikzset{>=latex}
\usepgfplotslibrary{external}
\tikzexternalize
 \begin{document}
\begin{tikzpicture}[scale=0.5, mydot/.style={minimum size=2pt, fill=black, inner sep=0pt, shape=circle, draw}]
\pgfplotsset{compat=1.12,
width =0.9\textwidth,
    height = 0.9\textwidth,
    legend cell align=left,
legend pos=outer north east,
legend style={draw=none, anchor=north west, at={(1.1,1)},font=\Large, xmin=-4, row sep=5pt, xmax=103,
},
every tick label/.append style={font=\Large},
yticklabel style={text width=3em,align=right},
 }
\begin{axis}[yshift=0cm, grid=major, ymin=-4, ymax=101,]
\fill[blue!60] (axis cs:35,60) circle[draw=black, radius=1,5];
\fill[blue!60] (axis cs:79,46) circle[draw=black, radius=1,5];
\fill[blue!60] (axis cs:3,45) circle[draw=black, radius=1,5];
\fill[blue!60] (axis cs:42,50) circle[draw=black, radius=1,5];
\fill[blue!60] (axis cs:3,40) circle[draw=black, radius=1,5];
\fill[blue!60] (axis cs:29,96) circle[draw=black, radius=1,5];
\fill[blue!60] (axis cs:47,30) circle[draw=black, radius=1,5];
\fill[blue!60] (axis cs:54,77) circle[draw=black, radius=1,5];
\fill[blue!60] (axis cs:36,30) circle[draw=black, radius=1,5];
\fill[blue!60] (axis cs:83,86) circle[draw=black, radius=1,5];
 \node[mydot](1) at (axis cs: 35, 60){};
 \node[mydot](2) at (axis cs: 79, 46){};
 \node[mydot](3) at (axis cs: 3, 45){};
 \node[mydot](4) at (axis cs: 42, 50){};
 \node[mydot](5) at (axis cs: 3, 40){};
 \node[mydot](6) at (axis cs: 29, 96){};
 \node[mydot](7) at (axis cs: 47, 30){};
 \node[mydot](8) at (axis cs: 54, 77){};
 \node[mydot](9) at (axis cs: 36, 30){};
 \node[mydot](10) at (axis cs: 83, 86){};

\fill[blue!60] (axis cs:24,63) circle[draw=black,radius=1,5];
\node[mydot](0) at (axis cs:24,63)[rectangle,draw, minimum size = 5pt, fill = black, inner sep = 0pt]{};
\end{axis}
\end{tikzpicture}
~\newpage
\begin{tikzpicture}[scale=0.5, mydot/.style={minimum size=2pt,     fill=black, inner sep=0pt, shape=circle, draw}]
\pgfplotsset{compat=1.12,
width =0.9\textwidth,
    height = 0.9\textwidth,
    legend cell align=left,
legend pos=outer north east,
legend style={draw=none, anchor=north west, at={(1.1,1)},font=\Large, xmin=-4, row sep=5pt, xmax=103,
},
every tick label/.append style={font=\Large},
yticklabel style={text width=3em,align=right},
 }
\begin{axis}[yshift=11cm, grid=major, ymin=-4, ymax=101,]
\fill[blue!60] (axis cs:33.98,59.9) rectangle (axis cs:35.92,61.8);
\fill[blue!60] (axis cs:33.98,58) rectangle (axis cs:35.92,59.9);
\fill[blue!60] (axis cs:32.04,59.9) rectangle (axis cs:33.98,61.8);
\fill[blue!60] (axis cs:35.92,59.9) rectangle (axis cs:37.86,61.8);
\fill[blue!60] (axis cs:32.04,58) rectangle (axis cs:33.98,59.9);
\fill[blue!60] (axis cs:35.92,58) rectangle (axis cs:37.86,59.9);
\fill[blue!60] (axis cs:78.6,44.7) rectangle (axis cs:80.54,46.6);
\fill[blue!60] (axis cs:78.6,42.8) rectangle (axis cs:80.54,44.7);
\fill[blue!60] (axis cs:78.6,46.6) rectangle (axis cs:80.54,48.5);
\fill[blue!60] (axis cs:76.66,44.7) rectangle (axis cs:78.6,46.6);
\fill[blue!60] (axis cs:76.66,42.8) rectangle (axis cs:78.6,44.7);
\fill[blue!60] (axis cs:76.66,46.6) rectangle (axis cs:78.6,48.5);
\fill[blue!60] (axis cs:2.94,44.7) rectangle (axis cs:4.88,46.6);
\fill[blue!60] (axis cs:2.94,42.8) rectangle (axis cs:4.88,44.7);
\fill[blue!60] (axis cs:1,44.7) rectangle (axis cs:2.94,46.6);
\fill[blue!60] (axis cs:1,42.8) rectangle (axis cs:2.94,44.7);
\fill[blue!60] (axis cs:41.74,48.5) rectangle (axis cs:43.68,50.4);
\fill[blue!60] (axis cs:41.74,50.4) rectangle (axis cs:43.68,52.3);
\fill[blue!60] (axis cs:39.8,48.5) rectangle (axis cs:41.74,50.4);
\fill[blue!60] (axis cs:39.8,50.4) rectangle (axis cs:41.74,52.3);
\fill[blue!60] (axis cs:2.94,39) rectangle (axis cs:4.88,40.9);
\fill[blue!60] (axis cs:2.94,37.1) rectangle (axis cs:4.88,39);
\fill[blue!60] (axis cs:2.94,40.9) rectangle (axis cs:4.88,42.8);
\fill[blue!60] (axis cs:1,39) rectangle (axis cs:2.94,40.9);
\fill[blue!60] (axis cs:1,37.1) rectangle (axis cs:2.94,39);
\fill[blue!60] (axis cs:1,40.9) rectangle (axis cs:2.94,42.8);
\fill[blue!60] (axis cs:28.16,94.1) rectangle (axis cs:30.1,96);
\fill[blue!60] (axis cs:26.22,94.1) rectangle (axis cs:28.16,96);
\fill[blue!60] (axis cs:30.1,94.1) rectangle (axis cs:32.04,96);
\fill[blue!60] (axis cs:45.62,29.5) rectangle (axis cs:47.56,31.4);
\fill[blue!60] (axis cs:45.62,27.6) rectangle (axis cs:47.56,29.5);
\fill[blue!60] (axis cs:45.62,31.4) rectangle (axis cs:47.56,33.3);
\fill[blue!60] (axis cs:43.68,29.5) rectangle (axis cs:45.62,31.4);
\fill[blue!60] (axis cs:47.56,29.5) rectangle (axis cs:49.5,31.4);
\fill[blue!60] (axis cs:43.68,27.6) rectangle (axis cs:45.62,29.5);
\fill[blue!60] (axis cs:47.56,27.6) rectangle (axis cs:49.5,29.5);
\fill[blue!60] (axis cs:53.38,77) rectangle (axis cs:55.32,78.9);
\fill[blue!60] (axis cs:53.38,75.1) rectangle (axis cs:55.32,77);
\fill[blue!60] (axis cs:51.44,77) rectangle (axis cs:53.38,78.9);
\fill[blue!60] (axis cs:55.32,77) rectangle (axis cs:57.26,78.9);
\fill[blue!60] (axis cs:51.44,75.1) rectangle (axis cs:53.38,77);
\fill[blue!60] (axis cs:55.32,75.1) rectangle (axis cs:57.26,77);
\fill[blue!60] (axis cs:35.92,29.5) rectangle (axis cs:37.86,31.4);
\fill[blue!60] (axis cs:35.92,27.6) rectangle (axis cs:37.86,29.5);

 \node[mydot](1) at (axis cs: 35, 60){};
 \node[mydot](2) at (axis cs: 79, 46){};
 \node[mydot](3) at (axis cs: 3, 45){};
 \node[mydot](4) at (axis cs: 42, 50){};
 \node[mydot](5) at (axis cs: 3, 40){};
 \node[mydot](6) at (axis cs: 29, 96){};
 \node[mydot](7) at (axis cs: 47, 30){};
 \node[mydot](8) at (axis cs: 54, 77){};
 \node[mydot](9) at (axis cs: 36, 30){};
 \node[mydot](10) at (axis cs: 83, 86){};
 \node[mydot](11) at (axis cs: 30, 6){};
 \node[mydot](12) at (axis cs: 55, 29){};
 \node[mydot](13) at (axis cs: 13, 2){};
 \node[mydot](14) at (axis cs: 1, 19){};
 \node[mydot](15) at (axis cs: 98, 1){};
 \node[mydot](16) at (axis cs: 75, 10){};
 \node[mydot](17) at (axis cs: 39, 23){};
 \node[mydot](18) at (axis cs: 62, 91){};
 \node[mydot](19) at (axis cs: 96, 9){};
 \node[mydot](20) at (axis cs: 27, 87){};
 \node[mydot](21) at (axis cs: 14, 16){};
 \node[mydot](22) at (axis cs: 52, 49){};
 \node[mydot](23) at (axis cs: 95, 21){};
 \node[mydot](24) at (axis cs: 30, 6){};
 \node[mydot](25) at (axis cs: 18, 40){};
 \node[mydot](26) at (axis cs: 82, 90){};
 \node[mydot](27) at (axis cs: 50, 79){};
 \node[mydot](28) at (axis cs: 48, 49){};
 \node[mydot](29) at (axis cs: 82, 73){};
 \node[mydot](30) at (axis cs: 64, 62){};
 \node[mydot](31) at (axis cs: 34, 78){};
 \node[mydot](32) at (axis cs: 83, 6){};
 \node[mydot](33) at (axis cs: 3, 77){};
 \node[mydot](34) at (axis cs: 18, 8){};
 \node[mydot](35) at (axis cs: 53, 86){};
 \node[mydot](36) at (axis cs: 88, 51){};
 \node[mydot](37) at (axis cs: 77, 51){};
 \node[mydot](38) at (axis cs: 58, 89){};
 \node[mydot](39) at (axis cs: 12, 44){};
 \node[mydot](40) at (axis cs: 70, 88){};
 \node[mydot](41) at (axis cs: 36, 17){};
 \node[mydot](42) at (axis cs: 85, 23){};
 \node[mydot](43) at (axis cs: 93, 30){};
 \node[mydot](44) at (axis cs: 68, 67){};
 \node[mydot](45) at (axis cs: 71, 34){};
 \node[mydot](46) at (axis cs: 56, 73){};
 \node[mydot](47) at (axis cs: 37, 37){};
 \node[mydot](48) at (axis cs: 78, 20){};
 \node[mydot](49) at (axis cs: 88, 69){};
 \node[mydot](50) at (axis cs: 95, 42){};
 \node[mydot](51) at (axis cs: 44, 71){};
 \node[mydot](52) at (axis cs: 18, 1){};

\fill[blue!60] (axis cs:22.34,61.8) rectangle (axis cs:24.28,63.7);
\fill[blue!60] (axis cs:22.34,59.9) rectangle (axis cs:24.28,61.8);
\fill[blue!60] (axis cs:22.34,63.7) rectangle (axis cs:24.28,65.6);
\fill[blue!60] (axis cs:24.28,61.8) rectangle (axis cs:26.22,63.7);
\fill[blue!60] (axis cs:24.28,59.9) rectangle (axis cs:26.22,61.8);
\fill[blue!60] (axis cs:24.28,63.7) rectangle (axis cs:26.22,65.6);
\node[mydot](0) at (axis cs:24,63)[rectangle,draw, minimum size = 5pt, fill = black, inner sep = 0pt]{};
\end{axis}
\end{tikzpicture}
~\newpage
\end{document}

我使用 WinEdt 和 MiKTeX。

相关内容