Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

2D Scatter Plot with Variable Size and Color

1,632 views
Skip to first unread message

Andy

unread,
Jul 20, 2007, 1:45:04 PM7/20/07
to
Hi, I am struggling with the necessary commands to achieve the type of
graph that I need. Basically I want to create a 2D version of one of
these:

http://gnuplot.sourceforge.net/demo_4.2/rgb_variable.html

I have a data file with lines like:

10 20 3
5 30 6

The first two values are x and y. Third value is size. I want the RGB
value to be calculated from x and y. Here is my script:

set terminal png nocrop enhanced size 420,320
set output "graph.png"
set title "Measurements"
rgb(r,g,b) = int(r)*65536 + int(g)*256 + int(b)
plot "data" using 1:2:3:(rgb($1,$2,0)) with points pt 7 ps variable lc
rgb variable

When I run it (gnuplot 4.2, Debian Sarge), I get:

"scatter.gnu", line 6: Too many using specs for this style

Any ideas? Help would be greatly appreciated!

regards, Andy

Ethan Merritt

unread,
Jul 20, 2007, 2:11:18 PM7/20/07
to
In article <1184953504.4...@z24g2000prh.googlegroups.com>,

Yes. Your commands are correct, and they work fine in the CVS
version of gnuplot. However, the use of variable color in 2D plots
was a last minute extension that didn't quite make it into the
4.2.0 release. It will be in the 4.2.1 incremental release,
expected in the next month or so.

As a work-around, in most cases it is possible to use a 3D plot with
"set view map" and giving a dummy Z coordinate. So your command
would become:


splot "data" using 1:2:(0):3:(rgb($1,$2,0)) \


with points pt 7 ps variable lc rgb variable


--
Ethan A Merritt

Andy

unread,
Jul 20, 2007, 2:50:37 PM7/20/07
to
Thanks Ethan - that worked great!

Andy

0 new messages