# Nonlinear color maps in surf plots

I have the following plot

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
domain = -20:30,
y domain = 0.01:100,
ymode=log,
view = {0}{90},
xlabel={$x$},
ylabel={$y$},
colorbar
]

{-1 + (y * sqrt(1+x^2))^2) / (1+y)^2};
\end{axis}
\end{tikzpicture}
\end{document}


which produces the following

However, I would like the colormap to be equally divided between [0,1] and [1, 1000]. Or possibly two different colormaps for the two ranges. How can I achieve this? I found this but this solution does not change the colormapping, just the colorbar.

• Maybe this post could help? It seems to address a very similar issue. – Ϛ . Oct 29 '18 at 12:42
• I do not understand your statement about this post. Isn't the only difference that you need to distinguish <1 and >1 instead of <0 and >0? – user121799 Oct 29 '18 at 15:06
• @marmot, I think I would also need to subtract 1 from y. In any case, if I use this solution the figure would not change, only the colorbar, i.e., the blue region would stay blue. The post by @Ϛ seems more to the point, although I would like more control than just logarithmic scaling, if that's possible with pgfplots. – Tohiko Oct 29 '18 at 17:03
• @Tohiko Sure. My statement is just to express that I am not convinced that "but this solution does not change the colormapping, just the colorbar." is correct. – user121799 Oct 29 '18 at 18:30