Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot: 3D plot scattered data with color

Tags:

gnuplot

How can I plot (many) uncorrelated points from a data file in 3D with color corresponding to the value of one column? The color-value is non-integral.

======================================================================

details:

I have a large data file with three columns of the form

longitude     latitude      color

The data is scattered and uncorrelated, i.e. no underlying grid and no relationship between the points (except that every coordinate appears only once). color is an arbitrary scalar. I know the min and the max value of that, and would like to have linear scaling of the color in between. Which colormap is not clear atm, a first step would be to produce any meaningful output.

How can I plot dots on the longitude-latitude coordinates on the unit sphere (i.e. radius = 1) with the specified color?

No interpolation is wanted, not even a connection between the points. (I'm also happy for suggestions how to do that in an easy way, but it's actually not important)

This is how far I've gone, but the coloring is missing:

set mapping spherical splot 'the_file.data' u 1:2:(1)

Thanks a bunch!

like image 642
rehctawrats Avatar asked Jan 01 '26 10:01

rehctawrats


1 Answers

You can use linecolor palette, which allows you to specify an additional column which is used to select the respective color from the current palette:

set mapping spherical
splot 'the_file.data' using 1:2:(1):3 linecolor palette
like image 179
Christoph Avatar answered Jan 03 '26 13:01

Christoph



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!