3D view of a 2D histogram (heat map) in gnuplot

How can I (or can) present this gnuplot histogram:

enter image description here


in this 3D histogram style - in gnuplot ?:

enter image description here


Using the same data and data format as in the gnuplot example in the answer would be better.

+8
gnuplot histogram heatmap
source share
2 answers

The closest thing available in gnuplot , which is not related to a substantial hacker and / or preprocessor, seems to be in impulses style. Reference documents even suggest using them for three-dimensional graphs:

To effectively use this style in 3D graphics, it is useful to select thick lines (line width> 1). This is approaching a three-dimensional diagram.

Here is a simple example using impulses data and matrix styles, as in the linked map example:

 set title '' unset key set xyplane 0 set view 60,300,1.2 set xrange [-0.5:5] set yrange [-0.5:5] splot '-' matrix with impulses lw 20 0 0 0 0 0 0 0 1 2 3 4 5 0 2 4 6 8 10 0 3 6 9 12 15 0 4 8 12 16 20 0 5 10 15 20 25 e 

enter image description here

The gnuplot problem displays pulses as strokes of a 2d pen. It would be ideal if some method applied a three-dimensional surface effect to these lines, but I don’t think there is a way, because these are just lines, not surfaces.

You can also use the vectors style to achieve a similar result until impulses above, but with support for the "rgb variable" (AFAIK pulses do not support this). This allows you to change color based on the z-value, but still does not have a 3d surface. You will need to use a different data format for the vector style (AFAIK), but this is a simpler conversion from matrix style data than another hack requires:

 set xyplane 0 set view 60,301,1.2 set xrange [0.5:5] set yrange [0.5:5] rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b) splot '-' using 1:2:(0):(0):(0):3:(rgb($3*(255/25),0,0)) with vectors nohead lw 40 5 5 25 5 4 20 5 3 15 5 2 10 5 1 5 4 5 20 4 4 16 4 3 12 4 2 8 4 1 4 3 5 15 3 4 12 3 3 9 3 2 6 3 1 3 2 5 10 2 4 8 2 3 6 2 2 4 2 1 2 1 5 5 1 4 4 1 3 3 1 2 2 1 1 1 e 

enter image description here

+1
source share

OP questions: How can I ...

There are several workarounds that produce a result similar to the pattern you are showing. They do not have all the bells and whistles that may be needed for formatting, but they are approximate that look "good."

I don't have gnuplot to check them out.

... (or I can)

It is widely documented that there is no way to plot a 3D histogram and anything to make such a plot real with the appropriate parameters (shading, spacing, back walls, perspective view, choice of point of view, etc.). requires complex user programming.

+2
source share

All Articles