Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wish to make a colormap where the distinction between numbers smaller than 0 and numbers greater than 0 is emphasised. So I want to make a colormap that has one sharp transition in the middle and fades to different colours on the edges. How can I do it? In the manual, I only found how to make gradual transitions.

share|improve this question

1 Answer 1

up vote 13 down vote accepted

You can declare your own color map, defining two colours for the transition point. Note that you might need to manually set a finer step size using the optional argument in the color map definition, to avoid incorrect colors near the transition point:


        rgb255(0pt)=(255, 200, 0);
        rgb255(500pt)=(255, 75, 0);
        rgb255(500pt)=(0, 100, 255);
        rgb255(1000pt)=(0, 255, 255)

\addplot [scatter, samples=50] {x};

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.