即,值为 10^{-6} 及以下的等高线仅用 0 标记。我是否达到了某些数字表示限制?
\documentclass[A4]{memoir}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotstableset{%
col sep=semicolon,
x index=0,
y index=1,
header=false
}%
\begin{filecontents*}{XYZ.csv}
2016; 1; 33e-9
2016; 2; 199e-9
2016; 3; 966e-9
2016; 4; 110e-9
2015; 1; 199e-9
2015; 2; 966e-9
2015; 3; 110e-9
2015; 4; 104e-9
2014; 1; 199e-9
2014; 2; 965e-9
2014; 3; 110e-9
2014; 4; 104e-9
2006; 1; 2349e-9
2006; 2; 6528e-9
2006; 3; 18405e-9
2006; 4; 17250e-9
1993; 1; 1167453e-9
1993; 2; 2376539e-9
1993; 3; 2262076e-9
1993; 4; 2262076e-9
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view = {0}{90}] ,zmode=log, log base=10 ]%
\addplot3[%
surf,shader=interp,opacity=0.8
] table {XYZ.csv};
\addplot3[%
contour gnuplot={levels={.0000001,.000001,.00001,.0001,.001,.01,.1},draw color=black},
] table {XYZ.csv};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
由于存在一个额外的内容,轴的一些选项会被忽略]
。因此,轴具有线性刻度 - 并且在线性刻度上,小数字会被压缩为零。您仍然可以重新配置轮廓线的显示范围(参见下面的第二幅图)。
只要您真的有了对数刻度,轮廓线就会以对数坐标计算。在这种情况下,Pgfplots 不是很智能,如果需要非对数数字,则必须重新配置数字打印机:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotstableset{%
col sep=semicolon,
x index=0,
y index=1,
header=false
}%
\begin{filecontents*}{XYZ.csv}
2016; 1; 33e-9
2016; 2; 199e-9
2016; 3; 966e-9
2016; 4; 110e-9
2015; 1; 199e-9
2015; 2; 966e-9
2015; 3; 110e-9
2015; 4; 104e-9
2014; 1; 199e-9
2014; 2; 965e-9
2014; 3; 110e-9
2014; 4; 104e-9
2006; 1; 2349e-9
2006; 2; 6528e-9
2006; 3; 18405e-9
2006; 4; 17250e-9
1993; 1; 1167453e-9
1993; 2; 2376539e-9
1993; 3; 2262076e-9
1993; 4; 2262076e-9
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\pgfplotsset{
contour/log labels/.style={
/pgfplots/contour/label node code/.code={
\node {$10^{\pgfmathprintnumber{##1}}$};
},
},
}
\begin{axis}[view = {0}{90} ,zmode=log, log basis z=10 ]%
\addplot3[%
surf,shader=interp,opacity=0.8
] table {XYZ.csv};
\addplot3[%
contour gnuplot={
levels={.0000001,.000001,.00001,.0001,.001,.01,.1},
draw color=black,
log labels,
},
] table {XYZ.csv};
\end{axis}
\end{tikzpicture}
\end{document}
这是轮廓标签数字打印机的更精确的线性刻度图形。默认情况下,它四舍五入为 3 位有效数字。
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotstableset{%
col sep=semicolon,
x index=0,
y index=1,
header=false
}%
\begin{filecontents*}{XYZ.csv}
2016; 1; 33e-9
2016; 2; 199e-9
2016; 3; 966e-9
2016; 4; 110e-9
2015; 1; 199e-9
2015; 2; 966e-9
2015; 3; 110e-9
2015; 4; 104e-9
2014; 1; 199e-9
2014; 2; 965e-9
2014; 3; 110e-9
2014; 4; 104e-9
2006; 1; 2349e-9
2006; 2; 6528e-9
2006; 3; 18405e-9
2006; 4; 17250e-9
1993; 1; 1167453e-9
1993; 2; 2376539e-9
1993; 3; 2262076e-9
1993; 4; 2262076e-9
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view = {0}{90}]%
\addplot3[%
surf,shader=interp,opacity=0.8
] table {XYZ.csv};
\addplot3[%
contour gnuplot={
levels={.0000001,.000001,.00001,.0001,.001,.01,.1},
draw color=black,
contour label style={/pgf/number format/std},
},
] table {XYZ.csv};
\end{axis}
\end{tikzpicture}
\end{document}
PS:三角形伪影实际上并不属于图片……似乎是convert -density 150
产生了这些伪影。