我尝试添加一个颜色条,但遇到了一些奇怪的行为。第一个颜色条可以正常工作:
\documentclass{article}
\usepackage{tikzscale,pgfplots}
\pgfplotsset{compat=1.13}
\newcommand\figurescale{1}
\newlength\figH
\newlength\figW
\begin{document}
\centering
\setlength{\figH}{0.5\textheight}
\setlength{\figW}{0.9\textwidth}
\begin{tikzpicture}
\begin{axis}[
width=\figW,
height=0.333\figH,
at={(0\figW,0.002\figH)},
hide axis,
scale only axis,
colorbar sampled,
colormap/jet,
colorbar style={
samples=100,
point meta min=295.1111,
point meta max=295.5111,
scaled y ticks = false,
ytick={295.1111,295.5111},
yticklabel style={/pgf/number format/.cd,precision=5},
}
]
\end{axis}
\end{tikzpicture}
\end{document}
但将 from 改为andpoint meta max
对应的as295.5111
295.2111
ytick
\documentclass{article}
\usepackage{tikzscale,pgfplots}
\pgfplotsset{compat=1.13}
\newcommand\figurescale{1}
\newlength\figH
\newlength\figW
\begin{document}
\centering
\setlength{\figH}{0.5\textheight}
\setlength{\figW}{0.9\textwidth}
\begin{tikzpicture}
\begin{axis}[
width=\figW,
height=0.333\figH,
at={(0\figW,0.002\figH)},
hide axis,
scale only axis,
colorbar sampled,
colormap/jet,
colorbar style={
samples=100,
point meta min=295.1111,
point meta max=295.2111,
scaled y ticks = false,
ytick={295.1111,295.2111},
yticklabel style={/pgf/number format/.cd,precision=5},
}
]
\end{axis}
\end{tikzpicture}
\end{document}
导致错误
包 pgfplots 错误:[mesh/rows=2,mesh/cols=75] 的参数假设 150 个点,但我实际上得到了 N = 192 个点!数据矩阵似乎不完整或过完整!?[使用 mesh/check=false 禁用此消息
转动mesh/check=false
没有帮助(它会导致颜色条损坏)。
更新
我可以用这个把间隔弄小一点:
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
hide axis,
scale only axis,
height=0pt,
width=0pt,
colorbar,
colormap/jet,
point meta min=295.1111,
point meta max=295.1121,
colorbar style={
height=10cm,
ytick={295.1111,295.1121},
yticklabel style={/pgf/number format/.cd,fixed,precision=9},
}]
\addplot [draw=none] coordinates {(0,0)};
\end{axis}
\end{tikzpicture}
\end{document}
但是将点元最大值从 295.1121 更改为 295.1112
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
hide axis,
scale only axis,
height=0pt,
width=0pt,
colorbar,
colormap/jet,
point meta min=295.1111,
point meta max=295.1112,
colorbar style={
height=10cm,
ytick={295.1111,295.1112},
yticklabel style={/pgf/number format/.cd,fixed,precision=9},
}]
\addplot [draw=none] coordinates {(0,0)};
\end{axis}
\end{tikzpicture}
\end{document}
得到
尺寸太大
错误。是否可以进一步减少 Colorbar 的显示间隔?是否有类似 pgfplots 错误维度太大适用于颜色条吗?
我想将元最大值更改为大约 295.11111112。
更新 2 Lualatex 在这里没有帮助,它会导致颜色条损坏: