I know that for a 4d color plot (3d surface, and the color is given by a 4th field), I can use a datafile of the format
# X Y Z C
1 1 0 4
1 2 1 3
2 1 4 2
2 2 4 5
...
and then use
set pm3d
splot "datafile.dat" u 1:2:3:4 with pm3d
On the other hand, I know how to make a simple surface plot where the X and Y values are implicit while the Z value is in matrix format:
#Z DATA ONLY
0 1
4 4
splot "datafile.dat" matrix
Is there a way to make 4d color plots using this matrix format? For example, taking the Z data from one file and the corresponding color data from another file, or combining both the Z value and the color into a single file in matrix format?
If I'm understanding the question correctly, this does appear possible. See the examples below.
http://www.gnuplotting.org/tag/matrix/
All we need to create such a plot is the
imageplot style, and of course the data have to be in a proper format. Suppose the following matrix which represents z-values of a measurement.0 1 2 3 4 3 2 1 0 0 1 2 3 4 3 2 1 0 0 1 2 3 4 3 2 1 0 0 1 2 3 4 3 2 1 0 0 1 2 3 4 3 2 1 0 0 1 2 3 4 3 2 1 0 0 1 2 3 4 3 2 1 0 0 1 2 3 4 3 2 1 0 0 1 2 3 4 3 2 1 0In order to plot these values in different gray color tones, we specify the corresponding
palette. In addition we apply the above mentionedimageplot style and thematrixformat option. The result is shown in Fig. 2.set palette grey plot 'color_map.dat' matrix with image
http://gnuplot.sourceforge.net/demo/heatmaps.html
# # Two ways of generating a 2D heat map from ascii data # set title "Heat Map generated from a file containing Z values only" unset key set tic scale 0 # Color runs from white to green set palette rgbformula -7,2,-7 set cbrange [0:5] set cblabel "Score" unset cbtics set xrange [-0.5:4.5] set yrange [-0.5:4.5] set view map splot '-' matrix with image 5 4 3 1 0 2 2 0 0 1 0 0 0 1 0 0 0 0 2 3 0 1 2 4 3 e e
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With