我試圖包含一個色條,在那裡我遇到了一些奇怪的行為。第一個 Colorbar 的工作原理:
\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}
但將point meta max
from更改295.5111
為295.2111
並對應ytick
as
\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 在這裡沒有幫助,它會導致色條損壞: