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

drawing rectangles with gnuplot

1,225 views
Skip to first unread message

Gene Wagenbreth

unread,
Mar 19, 2013, 2:28:41 PM3/19/13
to
I want to draw rectangles with gnuplot. I dont want to plot anything.

I create a rectangle with:
set object 2 rect from -1,1 to 0,5 fc rgb "gold"

but to see the rectangle I have to plot something:
plot [-5:5] x lc rgb "white"

How do I get gnuplot to just draw the rectangles I have defined ?

Will gnuplot support hundreds of different rectangles ?

Is there a better way to do this ?

Thanks

Gene W

Gene Wagenbreth

unread,
Mar 19, 2013, 4:23:56 PM3/19/13
to
I want filled rectangles.

Gene W

Christoph Bersch

unread,
Mar 20, 2013, 4:13:25 AM3/20/13
to
Am 19.03.2013 19:28, schrieb Gene Wagenbreth:
> I want to draw rectangles with gnuplot. I dont want to plot anything.
>
> I create a rectangle with:
> set object 2 rect from -1,1 to 0,5 fc rgb "gold"
>
> but to see the rectangle I have to plot something:
> plot [-5:5] x lc rgb "white"
>
> How do I get gnuplot to just draw the rectangles I have defined ?

You must plot something to get the rectangles, as you said.

> Will gnuplot support hundreds of different rectangles ?

Yes:

unset border
unset tics
do for [i=0:1000] {
x = 9*(rand(0)-0.5)
y = 9*(rand(0)-0.5)
set object rectangle from x, y to x+rand(0),y+rand(0) fc rgb "gold"
}
plot [-5:5] x lw 0 t ''

Christoph
0 new messages