Search code examples
3dgnuplot

How to make the choice in 3D color palette in gnuplot with light effect?


I am making a 3D surface plot and I am trying to adjust the 3D surface plot so that it gives more depth and light effect[reference fig 1]

However, my palate choice is really not good 2 Following is my code, any suggestion will be helpful.

**#!/usr/local/bin/gnuplot
reset
set terminal postscript eps enhanced color size 12cm,12cm  solid lw 3 "Times-Roman" 20
set output "Cubic.eps"
#set palette defined ( -0.09 "purple", -0.06 "blue", -0.03 "red", 0 "brown", 0.05 "yellow" )
#unset key
set pm3d
set parametric
set isosamples 100,100
set hidden3d
set sample 100,100
set surface
unset ylabel
unset zlabel
set title "(a)"
unset zrange
unset yrange
unset xrange
unset xtics
unset ytics
unset ztics
set border 0
set view 89,179,1,1
set zrange[-0.09:0.1]
#set cbrange[-0.09:0.1]
#set xlabel  "k_x (2pi/a)" rotate parallel offset 2,7,8 font "Times-Bold,25"
#set zlabel "k_z(2pi/a)"  rotate parallel offset 5,1,1 font "Times-Bold,25"
#set ylabel  "k_y (2pi/a)" rotate parallel offset -5,7,0 font "Times-Bold,25"
splot 'data.dat' u 4:5:8 notitle, 'data.dat' u 4:5:9 w pm3d notitle, 'data.dat' u 4:5:7 w pm3d notitle,'data.dat' u 4:5:10 w pm3d notitle,'data.dat' u 4:5:10 w pm3d notitle,'data.dat' u 4:5:9 w pm3d notitle**

Solution

  • Extract from the documentation:

    The command set pm3d lighting selects a simple lighting model consisting of a single fixed source of illumination contributing 50% of the overall lighting. The strength of this light relative to the ambient illumination can be adjusted by set pm3d lighting primary <fraction>. Inclusion of specular highlighting can be adjusted by setting a fractional contribution:

       set pm3d lighting primary 0.50 specular 0.0   # no highlights
       set pm3d lighting primary 0.50 specular 0.6   # strong highlights  
    

    Solid-color pm3d surfaces tend to look very flat without specular highlights. Since the highlights from a single source only affect one side of the surface, a second spotlight source may be desirable to add specular highlights from the opposite direction. This is controlled by "spec2 ".

    Whether a particular choice of color palette will help depends largely on what you are trying to show. The lighting model by itself may be sufficient, even with a miminal palette as in the figure below.

    set palette rgbformulae 8, 9, 7
    set pm3d depthorder noborder
    set pm3d lighting specular 0.6
    

    enter image description here