I have the following plot


    domain = -20:30,
    y domain = 0.01:100,
    view = {0}{90},

    \addplot3[surf,shader=interp, samples=41]%
    {-1 + (y * sqrt(1+x^2))^2) / (1+y)^2};

which produces the following MWE output

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, 2018 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, 2018 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, 2018 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, 2018 at 18:30


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.