Force z-Range at gnuplot - pm3d

I have several 2d data files that I want to build with gnuplot. Unfortunately, file values ​​are not in the same range. howevery, I need the z axis to be the same. here is my code:

set pm3d map interpolate 1,1

splot "Diff.txt" matrix using (1+$1):(1+$2):3 

unset key

set terminal png font arial 20 size 1200, 1200  


set palette defined (  0 "blue", 8 "white", 16 "red")
set zrange [-0.04:0.04]


set output "Diff.png"
replot

i we get the z axis from -0.015-0.02. is there any way to “force” gnuplot to use this range?

+3
source share
1 answer

The color range is determined cbrangeand does not match zrange. Using:

set terminal pngcairo font "Arial,20" size 1200,1200
set output 'Diff.png'

set pm3d map interpolate 1,1
unset key
set palette defined (  0 "blue", 8 "white", 16 "red")

set cbrange [-0.04:0.04]
splot "Diff.txt" matrix using (1+$1):(1+$2):3 

BTW: you should use a terminal pngcairothat gives better images than a terminal png(uses libgd). If your version of gnuplot is not related to libgd, then the terminal pngis linked to pngcairo. But in general, these two are different terminals.

+3
source

All Articles