我不知道密钥 /tikz/none

我不知道密钥 /tikz/none

I do not know the key /tikz/none我使用了 matplotlib2tikz,现在编译时出现 Package pgfkeys 错误: 。
我已\RequirePackage{pgfplots}指定\RequirePackage[utf8]{inputenc},但似乎缺少其他包。我查看了类似的 pgfkeys 错误,但没有找到与我类似的错误。\end{axis}他抱怨的是命令。

示例代码:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}

\begin{document}


 % This file was created by matplotlib2tikz v0.6.15.
\begin{tikzpicture}

\begin{axis}[
xlabel={X},
ylabel={Y},
xmin=0, xmax=1,
ymin=0, ymax=1,
xtick={0,0.2,0.4,0.6,0.8,1},
xticklabels={0.0,0.2,0.4,0.6,0.8,1.0},
ytick={0,0.2,0.4,0.6,0.8,1},
yticklabels={0.0,0.2,0.4,0.6,0.8,1.0},
tick align=outside,
xmajorticks=false,
ymajorticks=false,
xmajorgrids,
x grid style={white!80.0!black},
ymajorgrids,
y grid style={white!80.0!black},
axis line style={none}
]
\path [opacity=0] (axis cs:0,0)
--(axis cs:0,1);

\path [opacity=0] (axis cs:1,0)
--(axis cs:1,1);

\path [opacity=0] (axis cs:0,0)
--(axis cs:1,0);

\path [opacity=0] (axis cs:0,1)
--(axis cs:1,1);

\end{axis}

\begin{groupplot}[group style={group size=1 by 2}]
\nextgroupplot[
title={One},
xmin=-0.504549238967233, xmax=9.50454923896723,
ymin=-1.15474993521067, ymax=1.15474993521067,
xtick={0,1,2,3,4,5,6,7,8,9},
xticklabels={1,2,3,4,5,6,7,8,9,10},
tick align=outside,
tick pos=left,
xmajorgrids,
x grid style={white!80.0!black},
ymajorgrids,
y grid style={white!80.0!black},
axis line style={white!80.0!black}
]
\addplot [only marks, draw=green!50.19607843137255!black, fill=green!50.19607843137255!black, colormap={mymap}{[1pt]
  rgb(0pt)=(0.01060815,0.01808215,0.10018654);

}]
table{%
x                      y
+0.000000000000000e+00 +1.000000000000000e+00
+1.000000000000000e+00 -1.000000000000000e+00
+2.000000000000000e+00 +1.000000000000000e+00
+3.000000000000000e+00 -1.000000000000000e+00
+4.000000000000000e+00 +1.000000000000000e+00
+5.000000000000000e+00 -1.000000000000000e+00
+6.000000000000000e+00 +1.000000000000000e+00
+7.000000000000000e+00 -1.000000000000000e+00
+8.000000000000000e+00 +1.000000000000000e+00
+9.000000000000000e+00 -1.000000000000000e+00
};
\addplot [semithick, green!50.19607843137255!black, dashed, forget plot]
table {%
0 1
1 -1
2 1
3 -1
4 1
5 -1
6 1
7 -1
8 1
9 -1
};
\path [draw=white!80.0!black, fill opacity=0] (axis cs:0,-1.15474993521067)
--(axis cs:0,1.15474993521067);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:1,-1.15474993521067)
--(axis cs:1,1.15474993521067);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:-0.504549238967233,0)
--(axis cs:9.50454923896723,0);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:-0.504549238967233,1)
--(axis cs:9.50454923896723,1);

\nextgroupplot[
title={Two},
xmin=-0.504549238967233, xmax=9.50454923896723,
ymin=-1.15474993521067, ymax=1.15474993521067,
xtick={0,1,2,3,4,5,6,7,8,9},
xticklabels={1,2,3,4,5,6,7,8,9,10},
tick align=outside,
tick pos=left,
xmajorgrids,
x grid style={white!80.0!black},
ymajorgrids,
y grid style={white!80.0!black},
axis line style={white!80.0!black}
]
\addplot [only marks, draw=red, fill=red, colormap={mymap}{[1pt]
  rgb(0pt)=(0.01060815,0.01808215,0.10018654);

}]
table{%
x                      y
+0.000000000000000e+00 +1.000000000000000e+00
+1.000000000000000e+00 -1.000000000000000e+00
+2.000000000000000e+00 +1.000000000000000e+00
+3.000000000000000e+00 -1.000000000000000e+00
+4.000000000000000e+00 +1.000000000000000e+00
+5.000000000000000e+00 -1.000000000000000e+00
+6.000000000000000e+00 +1.000000000000000e+00
+7.000000000000000e+00 -1.000000000000000e+00
+8.000000000000000e+00 +1.000000000000000e+00
+9.000000000000000e+00 -1.000000000000000e+00
};
\addplot [semithick, red, dashed, forget plot]
table {%
0 1
1 -1
2 1
3 -1
4 1
5 -1
6 1
7 -1
8 1
9 -1
};
\path [draw=white!80.0!black, fill opacity=0] (axis cs:0,-1.15474993521067)
--(axis cs:0,1.15474993521067);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:1,-1.15474993521067)
--(axis cs:1,1.15474993521067);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:-0.504549238967233,0)
--(axis cs:9.50454923896723,0);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:-0.504549238967233,1)
--(axis cs:9.50454923896723,1);

\end{groupplot}

\end{tikzpicture}

\end{document}

答案1

好吧,错误来自axis line style={none},然后又有两个错误来自颜色图至少需要两个点的事实。这是一个可以运行的版本,因为我注释掉了有问题的行(并删除了两个空行)。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{groupplots}

\begin{document}


 % This file was created by matplotlib2tikz v0.6.15.
\begin{tikzpicture}

\begin{axis}[
xlabel={X},
ylabel={Y},
xmin=0, xmax=1,
ymin=0, ymax=1,
xtick={0,0.2,0.4,0.6,0.8,1},
xticklabels={0.0,0.2,0.4,0.6,0.8,1.0},
ytick={0,0.2,0.4,0.6,0.8,1},
yticklabels={0.0,0.2,0.4,0.6,0.8,1.0},
tick align=outside,
xmajorticks=false,
ymajorticks=false,
xmajorgrids,
x grid style={white!80.0!black},
ymajorgrids,
y grid style={white!80.0!black},
%axis line style={none}
]
\path [opacity=0] (axis cs:0,0)
--(axis cs:0,1);

\path [opacity=0] (axis cs:1,0)
--(axis cs:1,1);

\path [opacity=0] (axis cs:0,0)
--(axis cs:1,0);

\path [opacity=0] (axis cs:0,1)
--(axis cs:1,1);

\end{axis}

\begin{groupplot}[group style={group size=1 by 2}]
\nextgroupplot[
title={One},
xmin=-0.504549238967233, xmax=9.50454923896723,
ymin=-1.15474993521067, ymax=1.15474993521067,
xtick={0,1,2,3,4,5,6,7,8,9},
xticklabels={1,2,3,4,5,6,7,8,9,10},
tick align=outside,
tick pos=left,
xmajorgrids,
x grid style={white!80.0!black},
ymajorgrids,
y grid style={white!80.0!black},
axis line style={white!80.0!black}
]
\addplot [only marks, draw=green!50.19607843137255!black,
fill=green!50.19607843137255!black, 
%colormap={mymap}{[1pt]  rgb(0pt)=(0.01060815,0.01808215,0.10018654);}
]
table{%
x                      y
+0.000000000000000e+00 +1.000000000000000e+00
+1.000000000000000e+00 -1.000000000000000e+00
+2.000000000000000e+00 +1.000000000000000e+00
+3.000000000000000e+00 -1.000000000000000e+00
+4.000000000000000e+00 +1.000000000000000e+00
+5.000000000000000e+00 -1.000000000000000e+00
+6.000000000000000e+00 +1.000000000000000e+00
+7.000000000000000e+00 -1.000000000000000e+00
+8.000000000000000e+00 +1.000000000000000e+00
+9.000000000000000e+00 -1.000000000000000e+00
};
\addplot [semithick, green!50.19607843137255!black, dashed, forget plot]
table {%
0 1
1 -1
2 1
3 -1
4 1
5 -1
6 1
7 -1
8 1
9 -1
};
\path [draw=white!80.0!black, fill opacity=0] (axis cs:0,-1.15474993521067)
--(axis cs:0,1.15474993521067);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:1,-1.15474993521067)
--(axis cs:1,1.15474993521067);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:-0.504549238967233,0)
--(axis cs:9.50454923896723,0);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:-0.504549238967233,1)
--(axis cs:9.50454923896723,1);

\nextgroupplot[
title={Two},
xmin=-0.504549238967233, xmax=9.50454923896723,
ymin=-1.15474993521067, ymax=1.15474993521067,
xtick={0,1,2,3,4,5,6,7,8,9},
xticklabels={1,2,3,4,5,6,7,8,9,10},
tick align=outside,
tick pos=left,
xmajorgrids,
x grid style={white!80.0!black},
ymajorgrids,
y grid style={white!80.0!black},
axis line style={white!80.0!black}
]
\addplot [only marks, draw=red, fill=red, 
%colormap={mymap}{[1pt]  rgb(0pt)=(0.01060815,0.01808215,0.10018654);}
]
table{%
x                      y
+0.000000000000000e+00 +1.000000000000000e+00
+1.000000000000000e+00 -1.000000000000000e+00
+2.000000000000000e+00 +1.000000000000000e+00
+3.000000000000000e+00 -1.000000000000000e+00
+4.000000000000000e+00 +1.000000000000000e+00
+5.000000000000000e+00 -1.000000000000000e+00
+6.000000000000000e+00 +1.000000000000000e+00
+7.000000000000000e+00 -1.000000000000000e+00
+8.000000000000000e+00 +1.000000000000000e+00
+9.000000000000000e+00 -1.000000000000000e+00
};
\addplot [semithick, red, dashed, forget plot]
table {%
0 1
1 -1
2 1
3 -1
4 1
5 -1
6 1
7 -1
8 1
9 -1
};
\path [draw=white!80.0!black, fill opacity=0] (axis cs:0,-1.15474993521067)
--(axis cs:0,1.15474993521067);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:1,-1.15474993521067)
--(axis cs:1,1.15474993521067);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:-0.504549238967233,0)
--(axis cs:9.50454923896723,0);

\path [draw=white!80.0!black, fill opacity=0] (axis cs:-0.504549238967233,1)
--(axis cs:9.50454923896723,1);

\end{groupplot}

\end{tikzpicture}

\end{document}

相关内容