The best option you have is to use pm3d
. For this to work you must change your data file a bit: You must duplicate very line, change the z-value of the duplicate to 0
and add a new line, i.e. your first two data lines
1 1 2
2 1 4
must become
1 1 2
1 1 0
2 1 4
2 1 0
and so on. You still need the two consecutive empty lines later to separate different "walls".
If you have control over your data output, you could change your output routine, or you can use a command line tool like sed
sed 's/^([0-9]* [0-9]* )(.*)$/&
1 0
/' gistfile1.txt
or awk
:
awk '1; {print $1,$2,0,"
"}' gistfile1.txt
to do the conversion. Of course this can be done on-the-fly from within gnuplot. A complete, working script is then:
filename = 'gistfile1.txt'
sed = '< sed ''s/^([0-9]* [0-9]* )(.*)$/&
1 0
/'' '
set autoscale cbfix
set palette defined (0 'red', 1 'blue')
set pm3d depthorder
unset colorbox
unset key
set ticslevel 0
splot sed.filename using 1:2:3:(column(-2)) with pm3d
and the result using gnuplot 4.6.5 with your example data is:
Some additional notes:
- The fourth column is used to select a different value than the z-value for the coloring.
column(-2)
uses the block number (adjacent blocks are delimited by two empty lines) as color index.
- Points belonging to different data blocks aren't connected.
- With
set autoscale cbfix
you can better control the colors used for the planes.
- If you know, that you have e.g. three planes which should have specific colors you could also use
set palette defined (0 'red', 1 'green', 2 'blue')
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…