Bowzer2
Bowzer2

Reputation: 273

Gnuplot: How to assign specific colors to values out of palette range?

In the Gnuplot documentation it says:

The set cbrange command sets the range of values which are colored using the current palette by styles with pm3d, with image and with palette. Values outside of the color range use color of the nearest extreme.

However, I would like to assign values outside of color range different colors. How is this possible?

Upvotes: 1

Views: 944

Answers (1)

Lt. Frank Drebin
Lt. Frank Drebin

Reputation: 51

Since I do not have enough reputation to comment yet, I hope it's ok, if i post this as an answer..

I've only started using gnuplot recently myself, so I am not 100% if sure that this is what you're looking for, but take a loot at the answer to this post:

gnuplot palette, default and defined

The gist is that you can define your own color functions and those functions can have conditions (see the third line in the third code box: b(x) = (x == 1 ? 1 : sin(2*pi*x))). This way at the end of the colorscale, i.e., at x = 1 the blue value is set to 1, while for the rest of the scale it uses the sin(...) function, which would be 0 at x = 1.

Although it technically means that you do NOT ONLY color values outside your color scale range with a different color but also those exactly at the end (or beginning) of it, maybe you can use this in some way by, e.g., adjusting the range of the color scale slightly.

Upvotes: 1

Related Questions