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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With