Gnuplot color gamut

I have some XYZ data in a file and I use gnuplot to display it. I create a heat map, i.e. A 2D plot where the Z value is represented using color. Right now I am using the following script:

set palette defined (0 "blue", 1 "red") plot "xyz.dat" u $1:$2:$3 w image 

My problem is that gnuplot ignores 0 and 1 in the palette definition. It uses the specified colors, but scales to the minimum and maximum Z values ​​in the file. This makes it difficult to visually compare different graphs whose z range is different.

How do I tell gnuplot to stop scaling the z color range?

+6
source share
1 answer

The "set palette defined" command displays the gray values ​​that you get if you plan to use grayscale in the color palette; scaling to min → 0 and max → 1 is how it should work. If you want to make a set of graphs with the same data scaling, you want to use the "set cbrange" command. For instance,

  set cbrange [0:0.5] set palette defined (0 "blue", 1 "red") splot '++' using 1:2:(sin($1)*cos($2)) w image 

gives a graph of the image with a maximum value of 0.5, for red and 0 - blue. Subsequent graphs, for example

  splot '++' using 1:2:(0.5*sin($1)*cos($2)) w image 

will use the same scaling, so they can be compared.

+9
source

Source: https://habr.com/ru/post/922014/


All Articles