Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Close pm3d surfaces with depthorder enabled

Help
Ant
2013-11-22
2013-12-12
  • Ant
    Ant
    2013-11-22

    I want to plot a surface where each face has a different pm3d style. I tried the following:

    reset
    set format x "%.6f"
    set format y "%.6f"
    set format z "%.6f"
    set xrange[-10:10]
    set xtics border -10,5,10
    set yrange[-10:10]
    set ytics border -10,5,10
    set cbrange[0:2]
    set pm3d depthorder
    set palette defined (0 'green', 1 'red', 1 'blue', 2 'black')
    splot "pm3d1_1.dat" using 1:2:3:($3/200) with pm3d, "pm3d1_1.dat" using 1:2:($3-1):($3/200+1) with pm3d

    where 'pm3d1_1.dat' is the function z=xx+yy with z varying between 0 and 200 (x,y between -10 and 10). The problem is that the output doesn't look how I expected when viewed from certain points of view, like this one:

    http://i.stack.imgur.com/JRTve.png

    I'd appreciate any help and I'd like to know if there is an alternative to plot a surface with different pm3d styles on each face. Thanks.

     
  • Ethan Merritt
    Ethan Merritt
    2013-12-12

    So far as I know it is not possible to do exactly what you want. The "set pm3d" mode does not know anything about which side of a surface is visible. You would need "set hidden3d" for that. But the hidden3d mode in turn does not know about pm3d coloring, so that doesn't work either.

    For a surface like the one in your figure it might work to draw the surface twice, separated by a small displacement along the Z axis. But that solution works only for surfaces where the Z component of the surface normal is everywhere positive.