user2003965
user2003965

Reputation: 503

force z-Range in gnuplot - pm3d

i have some 2d data files, that i want to plot with gnuplot. Unfortunatly, the values of the files 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 get a z-axis from -0.015 - 0.02. is there any way to "force" gnuplot to use the given range?

Upvotes: 7

Views: 9616

Answers (1)

Christoph
Christoph

Reputation: 48390

The color range is defined by the cbrange and is not the same as the zrange. Use:

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 the pngcairo terminal, which gives better images than the png terminal (uses libgd). If your gnuplot version is not linked to libgd, then the png terminal is linked to pngcairo. But in general those two are different terminals.

Upvotes: 6

Related Questions