I am using gnuplot. I would like to compare across different settings of the same type of data in a color plot using something like the following:

plot 'pdratio' using 1:2:(abs($1)>0.3?$4:1/0) with p ps 0.75 pt 4 palette

Gnuplot automatically chooses the data range for the palette to map out color, which can be different from case to case. Is there a way to ask gnuplot to map out colors for the same data range consistently across different cases?

Something like set palette maxcolor 100 would not be adequate for my purposes.

  • you guys seem to have a lot of time dealing with these formatting/wording details, which is good for people to catch the questions quick. I had got a solution, can I answer my own question?
    – bsmile
    May 4 '17 at 18:47

Try using cbrange

The set cbrange command sets the range of values which are colored using the current palette docs_4.2

set cbrange [min:max] 

An example of its use can be found on SO

set palette defined (-1 "red", 0 "white", 1 "blue)
ub = 1
lb = -ub
set cbrange [lb:ub]
  • Your supposed to write reasonably explaining answers... And unless you have a picture you most likely have failed also... But maybe not in this case.
    – joojaa
    May 4 '17 at 18:53
  • what about a self-explaining answer like the one I just posted?
    – bsmile
    May 4 '17 at 19:06
  • Its rarely self explaining if its just a sentence. But again this may be a exception. altough you can introduce your onneliner in more than 0 letters.
    – joojaa
    May 4 '17 at 19:18

Your Answer

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

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