type_outcast
type_outcast

Reputation: 635

Adding vertical lines to 3D gnuplot graph

In the following trivial 3D gnuplot scatter graph, there are two points (labeled A and B). Unfortunately, since this there is no logical connection between the points, it's impossible to tell visually where these points lie in the 3D space.

Original graph

The way I would prefer to remedy this is to add vertical lines on the Z axis down to the Z = 0 floor plane, something like the following blue lines (color irrelevant) which I slapped on with MS Paint to illustrate what I want:

Same graph with vertical lines added

This way it's easy to see, for example, that A is higher than B. After some searching, I haven't been able to dig up anything on how to implement this with gnuplot. I would greatly appreciate any assistance whether it's an RTFM pointer, or existing example of how to implement this type of plot.

Upvotes: 2

Views: 1233

Answers (1)

type_outcast
type_outcast

Reputation: 635

Thanks to Murphy's Law, I finally stumbled upon the answer right after posting the question. The trick is to use with impulses in the splot graph definition, and then re-plot the same series with points to get crosses on top of the impulse lines. Here's the (somewhat stylized) result:

Final graph

For example's sake, below is the full gnuplot script I used to generate the above, although as mentioned, the splot line at the end with impulses and with points is the necessary bit to answer the question.

set object rect from screen 0, screen 0 to screen 1, \
           screen 1 fillcolor rgb "black" fillstyle solid 0.9 behind
set grid xtics ytics ztics mytics \
         linetype 3 linewidth 0 linecolor rgb "#3366aa", \
         linetype 3 linewidth 0 linecolor rgb "#3366aa"
set terminal postscript enhanced color size 10,4.9
set output "/path/to/graph.png"
set border linecolor rgb "#3366aa"
set xyplane 0

 splot '/path/to/data' title "" with impulses linecolor rgb "#556600", \
       '/path/to/data' title "" with points   linecolor rgb "#eeff66"

Upvotes: 3

Related Questions