The first three columns is the coordinate of a specific point, and the
fourth colomn is the value of the point.
I hope to plot those points in 3D space with the value presented by
different color, for example, bule for negative value and red for
positive, or from bule to red with gradual change.
I can not find a way to do so. Would you like to give me some
suggestions?
Thank you very much for your kindly help.
Best wishes,
Jinsong
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear all,
I have a data set with the following format:
1.889730 -0.944860 -5.669180 -0.011924
2.834590 -0.944860 0.000000 0.005855
0.944860 0.000000 2.618500 -0.023102
1.889730 0.000000 5.615540 0.023313
.....
.....
The first three columns is the coordinate of a specific point, and the
fourth colomn is the value of the point.
I hope to plot those points in 3D space with the value presented by
different color, for example, bule for negative value and red for
positive, or from bule to red with gradual change.
I can not find a way to do so. Would you like to give me some
suggestions?
Thank you very much for your kindly help.
Best wishes,
Jinsong
I've seen that in version 4.1 there's an hint to solve your problem, under unix using awk...
1. You need version 4.1(dev.) or +
http://gnuplot.sourceforge.net/demo_4.1/datastrings.html
Give a look to last plot.
(http://gnuplot.sourceforge.net/demo_4.1/datastrings.8.gnu)
Starting from here we can "argue" how to plot with different color the points using value of column 4.
2. Under Unix you can use 'awk'
awk '{if((NR>=0))print $1,$2,$3,10} ' nomefile.dat
awk '{if((NR<=0))print $1,$2,$3,-10} ' nomefile.dat
These commands replace on the output column 4 with 10 if the previous value was >=0 and with -10 if it was <0.
Obviously you can use other value (as you like) instead of -10 and 10 (it depends from the palette you will choose).
------------------------------
so you can try somethings like:
set pm3d at s
set colorbox user
set colorbox horizontal origin 0.1,0.1 size 0.8,0.04 bdefault
splot "< awk '$0 !~ /^#/ {if(NR>=0) print $1,$2,$3,10}' myfile.dat" using ($1):($2):($3):($4) with points pt 6 ps 3 pal t "gt 0",\ "< awk '$0 !~ /^#/ {if(NR<0) print $1,$2,$3,-10}' myfile.dat" using ($1):($2):($3):($4) with points pt 6 ps 3 pal t "lt 0"
good luck