使用 更改热图中的 z 范围zmin
,zmax
要么不执行任何操作(参见下图),要么生成一条消息You have an axis with empty range (in direction y). Replacing it with a default range and clearing all plots.
如何设置对数热图中的 z 范围?
\begin{filecontents}{map.txt}
0.1 0 2.933100901655603E-6
0.1 10 1.2378929491530841E-5
0.1 20 2.0588051604902755E-5
0.1 30 2.7190941686966532E-5
0.1 40 3.290721897852047E-5
0.1 60 4.250275971734089E-5
0.1 80 5.0350197981567186E-5
0.1 100 5.681643648591518E-5
0.1 150 6.859558257512272E-5
0.1 200 7.652271637806553E-5
0.1 250 8.22752949739641E-5
0.1 300 8.668070617985642E-5
0.2 0 1.362157048411715E-5
0.2 10 1.4186557576426701E-5
0.2 20 1.9510106350903664E-5
0.2 30 2.3880991840192088E-5
0.2 40 2.7472817836855655E-5
0.2 60 3.282892845070262E-5
0.2 80 3.656164586607819E-5
0.2 100 3.944614546159667E-5
0.2 150 4.434691145348564E-5
0.2 200 4.730750444203243E-5
0.2 250 4.9180711846180925E-5
0.2 300 5.0512424521156164E-5
\end{filecontents}
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
zmin=-10,zmax=10,
view={0}{90},
colormap/jet,
colorbar,
colorbar style={yticklabel=$10^{\pgfmathprintnumber{\tick}}$},
]
\addplot3 [
surf,
shader=interp,
] table [
x index=0,
y index=1,
z expr=log10(\thisrowno{2}),
] {map.txt};
\end{axis}
\end{tikzpicture}
\end{document}