I have a question about pm3d and gnuplot. I want to plot two different surfaces with two different pm3d styles. How can i do that? Is it possible? I tried with multiplot but
Here is an example with pseudo data:
reset
set xrange[0:1]
set yrange[0:1]
set cbrange[0:1]
set palette defined (0 'green', 1 'red', 1 'blue', 2 'white')
set isosamples 100
set samples 100
set pm3d depthorder
set view 60,335
splot '++' using 1:2:2:(0.5*$2) with pm3d title 'red -> green',\
'++' using 1:2:1:(0.5*(1+$1)) with pm3d title 'blue -> white'
Result:
To use data instead of these pseudo data generated by '++' you can use stats
to determine the data ranges and scale the surface colors accordingly to [0:0.5]
for one, and to [0.5:1]
for the other.
This concept with the different color ranges to incorporate two palettes in one does work only for data files (including pseudo data files). To plot two spheres beneath each other with different colors, one can first produce a data file, which is later used for pm3d
plotting:
reset
# generate the sphere data
set samples 100
set isosamples 100
set parametric
set urange[0:2*pi]
set vrange[0:pi]
set table 'spheres.dat'
r = 0.25
splot r*cos(u)*sin(v),r*sin(u)*sin(v),r*cos(v) with lines
unset table
unset parametric
# plot the generated data set
set xrange[-1:1]
set yrange[-1:1]
set cbrange[-1:3]
set palette defined (0 'black', 1 'green', 1 'black', 2 'red')
set pm3d depthorder
unset colorbox
unset key
set ticslevel 0
set view 19,34
splot 'spheres.dat' using ($1-0.5):2:3:($3/r) with pm3d, \
'' using ($1+0.5):2:3:($3/r + 2) with pm3d
The result is