
我正在嘗試為我的一份文件建立顏色圖。為了測試並查看此顏色圖的外觀,我使用了該\pgfplotscolorbardrawstandalone
命令。
然而,當使用此指令時,顏色圖的上部在本應為紅色的情況下卻變灰了。另一方面,當我在圖表中使用顏色圖時,顏色是正確的。 (與預先定義的顏色圖相同。)
你知道問題出在哪裡嗎?
是否應該在命令中添加選項\pgfplotscolorbardrawstandalone
?
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{colormap={mycolormap}{
rgb255=(80,80,80)
rgb255=(255,255,255)
rgb255=(230,40,25)
},
}
\begin{document}
\pgfplotscolorbardrawstandalone[colormap name=mycolormap]
\begin{tikzpicture}
\begin{axis}[hide axis, colormap name=mycolormap]
\addplot3[surf, samples=50, domain=-8:8]
{sin(deg(sqrt(x^2+y^2)))/sqrt(x^2+y^2)};
\end{axis}
\end{tikzpicture}
\pgfplotscolorbardrawstandalone[colormap name=viridis]
\begin{tikzpicture}
\begin{axis}[hide axis, colormap name=viridis]
\addplot3[surf, samples=50, domain=-8:8]
{sin(deg(sqrt(x^2+y^2)))/sqrt(x^2+y^2)};
\end{axis}
\end{tikzpicture}
\end{document}