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

splotting with pointsize variable => huge points!!!

1,125 views
Skip to first unread message

gvdmoort

unread,
Jun 6, 2012, 5:27:12 AM6/6/12
to
Hello,

I'm trying to plot with points of variable size with gnuplot 4.4 on a
Debian testing platform.

I've found this trick on http://www.gnuplot.info/demo_canvas/pointsize.html:

plot 'world.dat' with lines lt 3, \
'world.cor' using 1:2:(5.*rand(0)) with points lt 1 pt 6 ps
variable

I've tried something simple:

gnuplot> splot '-' matrix with points pt 7 ps variable
input data ('e' ends) > 0 1
input data ('e' ends) > 2 3
input data ('e' ends) > e
input data ('e' ends) > e

but the resulting plot has so huge points that they cover nearly all
the plot, such I get a quasi full-red terminal...

Is it possible to get a plot with reasonably well-sized points with
this version of gnuplot (and how) or is it mandatory to upgrade to get
suh result ?

Thanks in advance,

Gauthier

sfeam

unread,
Jun 6, 2012, 7:43:37 PM6/6/12
to
gvdmoort wrote:

> I'm trying to plot with points of variable size with gnuplot 4.4 on a
> Debian testing platform.
>
> I've found this trick on
> http://www.gnuplot.info/demo_canvas/pointsize.html:
>
> plot 'world.dat' with lines lt 3, \
> 'world.cor' using 1:2:(5.*rand(0)) with points lt 1 pt 6 ps
> variable
>
> I've tried something simple:
>
> gnuplot> splot '-' matrix with points pt 7 ps variable
> input data ('e' ends) > 0 1
> input data ('e' ends) > 2 3
> input data ('e' ends) > e
> input data ('e' ends) > e
>
> but the resulting plot has so huge points that they cover nearly all
> the plot, such I get a quasi full-red terminal...

Getting any point at all from that command is a bug.
The 3D matrix format provides implicit x,y values and one explicit z
value for each point. There is no additional (4th) data column from
which you can read a point size.

I am guessing that you really were aiming for a 2D plot?
In that case the command you want is

gnuplot> plot '-' matrix using 1:2:3 with points pt 7 ps variable

This command does work here using gnuplot version 4.4, but
the exact size of the points will depend on the terminal type.

Ethan

gvdmoort

unread,
Jun 7, 2012, 3:16:57 PM6/7/12
to
On 7 juin, 01:43, sfeam <sf...@users.sourceforge.net> wrote:

> I am guessing that you really were aiming for a 2D plot?
> In that case the command you want is
>
> gnuplot> plot '-' matrix using 1:2:3 with points pt 7 ps variable
>

Thanks for your reaction. There was some confusion in my 1rst message
because I also tried to plot data from an image to points with
variable size.

This doesn't work:

gnuplot> plot 'grey_small.png' binary filetype=auto using 1:2:($3/255)
with points pt 7 ps variable
Too many using specs for this style

but I've found a solution by "splotting" the image and export the
result in a table:

gnuplot> splot 'grey_small.png' binary filetype=auto
gnuplot> set table 'grey_small.dat'
gnuplot> replot

And then:

gnuplot> plot 'grey_small.dat' using 1:2:($3/255) with points pt 7 ps
variable

By the way, are the heights given by the value of a pixel always
between 0 and 255, or do they depend on the format of the image
(pixels on 8, 16, 32 bits...) ?

Thanks,

Gauthier

sfeam

unread,
Jun 7, 2012, 5:12:06 PM6/7/12
to
gvdmoort wrote:

> On 7 juin, 01:43, sfeam <sf...@users.sourceforge.net> wrote:
>
>> I am guessing that you really were aiming for a 2D plot?
>> In that case the command you want is
>>
>> gnuplot> plot '-' matrix using 1:2:3 with points pt 7 ps variable
>>
>
> Thanks for your reaction. There was some confusion in my 1rst message
> because I also tried to plot data from an image to points with
> variable size.
>
> This doesn't work:
>
> gnuplot> plot 'grey_small.png' binary filetype=auto using 1:2:($3/255)
> with points pt 7 ps variable
> Too many using specs for this style


Hold on a moment.
Originally you were asking about ascii input data -
how does this PNG file fit into the picture?

It would help if you would explain what you are trying to do.
Is the idea to map the pixel value into a point size? Why?
What is the mapping? Are you sure you want a PNG file for this?

The input mode "binary filetype=png" (you used "auto" but that's the same
since it's a png image) is only intended for use with the image plot
styles (with image, with rgbalpha, etc). But "set table" doesn't know how
to dump image data, so I suspect you're just plotting garbage at that point.

Ethan

sfeam

unread,
Jun 7, 2012, 5:27:41 PM6/7/12
to
Note:
If you really want to dump the RGBAlpha values from a PNG file in gnuplot,
you can mis-use a different 6-column plot mode:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gnuplot> set table
gnuplot> plot 'bldg.png' binary filetype=png with xyerrorbar

# Curve 0 of 1, 6527 points
# Curve title: "'bldg.png' binary filetype=png"
# x y xlow xhigh ylow yhigh type
0 127 255 255 255 255 i
1 127 255 255 255 255 i
... and so on ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Although "set table" labels the columns xlow/xhigh/ylow/yhigh
in this case they are really Red/Green/Blue/Alpha




gvdmoort

unread,
Jun 8, 2012, 3:10:06 AM6/8/12
to
On 7 juin, 23:12, sfeam <sf...@users.sourceforge.net>
> Hold on a moment.
> Originally you were asking about ascii input data -
> how does this PNG file fit into the picture?

I'm sorry; as I said, I was searching how to plot gridded data with
points of different sizes, and I've tested differents ways, such ascii
data, and images, hence the confusion.

> But "set table" doesn't know how
to dump image data, so I suspect you're just plotting garbage at that
point.

I confirm however that if I dump image data in the context of a 3D
plot, I get the values as series of points, one by line of pixels:


# IsoCurve 9, 10 points
# x y z type
0 9 111 i
1 9 114 i
2 9 187 i
3 9 186 i
4 9 134 i
5 9 193 i
6 9 144 i
7 9 99 i
8 9 106 i
9 9 110 i

So, with that third column, I can make a 2D gridded plot with
different sizes of points, as explained before.

With my aplologies,

Gauthier

gvdmoort

unread,
Jun 8, 2012, 3:22:38 AM6/8/12
to
On 7 juin, 23:12, sfeam <sf...@users.sourceforge.net> wrote:
> Hold on a moment.
> Originally you were asking about ascii input data -
> how does this PNG file fit into the picture?
>

As I said, I was trying to plot gridded data with points of different
sizes, and made different tests with ascii data, images and so, hence
the confusion.

>  But "set table" doesn't know how
> to dump image data, so I suspect you're just plotting garbage at that point.

I confirm however that in the context of a 3D plot, dumping image-
heights to a table gives meaningfull data, one curve by range of
pixels:

# Surface 0 of 1 surfaces

# Curve title: "'grey_small.png' binary filetype=auto"
# IsoCurve 0, 10 points
# x y z type
0 0 110 i
1 0 105 i
2 0 72 i
3 0 156 i
4 0 169 i
...


With the 3d column, I got the opportunity to make a 2d plot with
different sizes of points.

With my apologies,

Gauthier

0 new messages