使用选项 colormap access=piecewise constant 时,pgfplots colorbar 中的颜色错误

使用选项 colormap access=piecewise constant 时,pgfplots colorbar 中的颜色错误

我正在尝试生成带有颜色条的轮廓图。以下示例在 TeXworks 中看起来不错,但在旧版本的 Adob​​e 和 Foxit 中,颜色条无法显示正确的颜色。如下图所示。

在此处输入图片描述

如果colormap access=piecewise constant删除该选项,则颜色条在所有查看器中看起来都很好,但会被插入。我在这里做错了什么?

\documentclass[paper=A5]{scrartcl}

\usepackage{pgfplots}
\pgfplotsset{compat=1.3}

\begin{document}

\pgfplotstableread{
0.000000e+00    4.000000e+00
3.300000e+01    4.000000e+01
3.250000e+01    3.600000e+01
3.150000e+01    3.400000e+01
2.900000e+01    3.250000e+01
2.000000e+00    5.300000e+01
3.308081e+01    2.800000e+01
3.300000e+01    2.766667e+01
3.227273e+01    2.800000e+01
3.200000e+01    2.813043e+01
3.100000e+01    2.863636e+01
3.033333e+01    2.900000e+01
3.000000e+01    2.919048e+01
2.900000e+01    2.980000e+01
2.869231e+01    3.000000e+01
2.800000e+01    3.047368e+01
2.728571e+01    3.100000e+01
2.700000e+01    3.122222e+01
2.606667e+01    3.200000e+01
2.600000e+01    3.205882e+01
2.500000e+01    3.300000e+01
2.600000e+01    3.322857e+01
2.700000e+01    3.353333e+01
2.800000e+01    3.396000e+01
2.807692e+01    3.400000e+01
2.900000e+01    3.460000e+01
2.944444e+01    3.500000e+01
3.000000e+01    3.566667e+01
3.021739e+01    3.600000e+01
3.071429e+01    3.700000e+01
3.100000e+01    3.780000e+01
3.106061e+01    3.800000e+01
3.131579e+01    3.900000e+01
3.151163e+01    4.000000e+01
3.166667e+01    4.100000e+01
3.182927e+01    4.200000e+01
3.200000e+01    4.277778e+01
3.205882e+01    4.300000e+01
3.240741e+01    4.400000e+01
3.300000e+01    4.500000e+01
3.330476e+01    4.400000e+01
3.358182e+01    4.300000e+01
3.383478e+01    4.200000e+01
3.400000e+01    4.129630e+01
3.406667e+01    4.100000e+01
3.408475e+01    4.000000e+01
3.410345e+01    3.900000e+01
3.412281e+01    3.800000e+01
3.414286e+01    3.700000e+01
3.416364e+01    3.600000e+01
3.418519e+01    3.500000e+01
3.420755e+01    3.400000e+01
3.423077e+01    3.300000e+01
3.400971e+01    3.200000e+01
3.400000e+01    3.195652e+01
3.378431e+01    3.100000e+01
3.355446e+01    3.000000e+01
3.332000e+01    2.900000e+01
3.308081e+01    2.800000e+01
4.000000e+00    1.100000e+01
5.716327e+01    1.600000e+01
5.700000e+01    1.585714e+01
5.683673e+01    1.600000e+01
5.600000e+01    1.683673e+01
5.585714e+01    1.700000e+01
5.600000e+01    1.713793e+01
}\mydata


\pgfplotsset{colormap={jet}{rgb255(0cm)=(0,0,128) rgb255(1cm)=(0,0,255)rgb255(3cm)=(0,255,255) rgb255(5cm)=(255,255,0) rgb255(7cm)=(255,0,0) rgb255(8cm)=(128,0,0)}}
\begin{figure}
    \centering
    \begin{tikzpicture}
        \begin{axis}[
                width=.93\textwidth,
                height=.45\textheight,
                xmin=7,
                xmax=67,
                ymin=7,
                ymax=67,
                axis x line=bottom,
                axis y line=left,
                ticks=none,
                colormap={myjet}{samples of colormap=(20 of jet)},
                colormap access=piecewise constant,
                colorbar,
                colorbar style={
                        width=8pt,
                        ytick={0,2,...,20},
                        yticklabel style={
                        /pgf/number format/.cd,
                            fixed,
                            fixed zerofill,
                            precision=1
                        }
                },clip=false]

            \addplot[thick,contour prepared,contour prepared format=matlab,/pgfplots/contour/labels=false] table[col sep = tab] {\mydata};
        \end{axis}
    \end{tikzpicture}
\end{figure}



\end{document}

相关内容