Discussion:
mapping z-values as point colors onto 2D plot
(too old to reply)
Hallmarc
2007-10-24 17:31:48 UTC
Permalink
Hi everyone,

Any help with this is much appreciated. I have a 3 column data file
that I would like to plot in 2D, with the 3rd column of the row
representing the color (within a spectrum) of that point. I've tried
a few things, including splotting with pm3d, but I can't seem to get
the thing that I want. This seems quite simple, and I think I just
haven't worked with Gnuplot long enough to get the fundamental
concept. Feel free to berate me, because I've read a whole lot of the
manual but can't figure this out.

Regards,
Marc
Ethan Merritt
2007-10-24 17:39:50 UTC
Permalink
Post by Hallmarc
Hi everyone,
Any help with this is much appreciated. I have a 3 column data file
that I would like to plot in 2D, with the 3rd column of the row
representing the color (within a spectrum) of that point. I've tried
a few things, including splotting with pm3d, but I can't seem to get
the thing that I want. This seems quite simple, and I think I just
haven't worked with Gnuplot long enough to get the fundamental
concept.
Maybe:
set view map
splot 'data' using 1:2:3 with pm3d

If that's not it, then you need to explain more clearly what
you are aiming for.
--
Ethan A Merritt
Hallmarc
2007-10-24 18:56:37 UTC
Permalink
Post by Ethan Merritt
Post by Hallmarc
Hi everyone,
Any help with this is much appreciated. I have a 3 column data file
that I would like to plot in 2D, with the 3rd column of the row
representing the color (within a spectrum) of that point. I've tried
a few things, including splotting with pm3d, but I can't seem to get
the thing that I want. This seems quite simple, and I think I just
haven't worked with Gnuplot long enough to get the fundamental
concept.
set view map
splot 'data' using 1:2:3 with pm3d
If that's not it, then you need to explain more clearly what
you are aiming for.
--
Ethan A Merritt
Unfortunately, there's something I'm not understanding about pm3d:

gnuplot> splot "socks.dat" using 1:3:4 with pm3d
Warning: Single isoline (scan) is not enough for a pm3d plot.
Hint: Missing blank lines in the data file? See 'help pm3d' and
FAQ.

socks.dat is a file with several hundred thousand rows, four columns
(column 2 is not used), and no breaks between rows. I want gnuplot to
plot column 1 on the x axis, column 3 on the y axis, and column 4
needs to be the color of the point at that (x,y) coordinate. The
colors range from 0 to 4500. The top of the data file has a few
comments (#), a single blank line, then the rest of the data.

Any ideas?
Hans-Bernhard Bröker
2007-10-24 19:41:37 UTC
Permalink
Post by Hallmarc
gnuplot> splot "socks.dat" using 1:3:4 with pm3d
Warning: Single isoline (scan) is not enough for a pm3d plot.
Hint: Missing blank lines in the data file? See 'help pm3d' and
FAQ.
socks.dat is a file with several hundred thousand rows, four columns
(column 2 is not used), and no breaks between rows.
... which means it doesn't describe any surface, so pm3d can't plot it
as a coloured surface. Looks like what you really want is a plot of
coloured points, i.e.:

set view map
splot 'data' u 1:2:(0.0):3 with points palette

Either that, or you should insert the missing breaks into the data file.
Hallmarc
2007-10-24 20:33:10 UTC
Permalink
Post by Hans-Bernhard Bröker
Post by Hallmarc
gnuplot> splot "socks.dat" using 1:3:4 with pm3d
Warning: Single isoline (scan) is not enough for a pm3d plot.
Hint: Missing blank lines in the data file? See 'help pm3d' and
FAQ.
socks.dat is a file with several hundred thousand rows, four columns
(column 2 is not used), and no breaks between rows.
... which means it doesn't describe any surface, so pm3d can't plot it
as a coloured surface. Looks like what you really want is a plot of
set view map
splot 'data' u 1:2:(0.0):3 with points palette
Either that, or you should insert the missing breaks into the data file.
That did the trick, thanks! I guess the third coordinate of 0.0 just
basically push everything up against a 2D plane...excellent.
Alicreance Hiyadutuje
2022-09-20 12:18:12 UTC
Permalink
Post by Hans-Bernhard Bröker
Post by Hallmarc
gnuplot> splot "socks.dat" using 1:3:4 with pm3d
Warning: Single isoline (scan) is not enough for a pm3d plot.
Hint: Missing blank lines in the data file? See 'help pm3d' and
FAQ.
socks.dat is a file with several hundred thousand rows, four columns
(column 2 is not used), and no breaks between rows.
... which means it doesn't describe any surface, so pm3d can't plot it
as a coloured surface. Looks like what you really want is a plot of
set view map
splot 'data' u 1:2:(0.0):3 with points palette
Either that, or you should insert the missing breaks into the data file.
That did the trick, thanks! I guess the third coordinate of 0.0 just
basically push everything up against a 2D plane...excellent.
In my case, I was missing only "with points palette".

Loading...