Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

force z-Range in gnuplot - pm3d

Tags:

gnuplot

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?

like image 926
user2003965 Avatar asked Feb 24 '14 22:02

user2003965


1 Answers

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.

like image 104
Christoph Avatar answered Oct 15 '22 20:10

Christoph