Hi,

the example works if you follow the text in the error message which 
states that the input offsets of the colormap must be a multiple of your 
meshwidth, configured as [5pt] in your example.

The colorbar compiles fine with the following slightly adopted offsets

\pgfplotsset{
colormap={myNewColor}{[5pt]
rgb255(0pt)=(255,0,0);
rgb255(510pt)=(0,255,10);
rgb255(550pt)=(0,255,0);
rgb255(790pt)=(100,255,0);
rgb255(1000pt)=(0,0,255)}
}

You could add data points at 505pt or 785pt if you want discontinuous 
color transitions. Is that what you mean by "non-linear colormap"?

Kind regards

Christian

Am 10.08.2015 23:26, schrieb Joan Hensen:
> Hey guys.
>
> I'm interested in pgfplots in order to generate a non-linear colormap. 
> Is there a way to get the following example to work without doing lots 
> of "hacks"?
>
> Kind regards,
>
> Joan
>
>
> \documentclass{article}
>
>
> \usepackage{pgfplots}
>
>
> \begin{document}
>
>
> \begin{figure*}[!t]
> \centering
> \begin{minipage}[c]{\textwidth}
> \begin{tikzpicture}
> \pgfplotsset{
> colormap={myNewColor}{[5pt]
> rgb255(0pt)=(255,0,0);
> rgb255(511pt)=(0,255,10);
> rgb255(550pt)=(0,255,0);
> rgb255(789pt)=(100,255,0);
> rgb255(1000pt)=(0,0,255)}
> }
> \footnotesize
> \begin{axis}[
> hide axis,
> scale only axis,
> height=0pt,
> width=0pt,
> colorbar horizontal,
> point meta min=-1,
> point meta max=1,
> colorbar style={
> height=0.5cm,
> width=6cm,
> xtick={-1,0,1}
> }]
> \addplot [draw=none] coordinates {(0,0)};
> \end{axis}
> \end{tikzpicture}
> \end{minipage}
> \caption{aaa}
> \end{figure*}
>
>
> \end{document}
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Pgfplots-features mailing list
> Pgfplots-features@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pgfplots-features


------------------------------------------------------------------------------
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to