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

arrows plotted outside of graph

734 views
Skip to first unread message

panchankos

unread,
Jan 27, 2011, 10:26:21 AM1/27/11
to
Is this expected behavior?

Generated a small plot on a large canvas by specifying the margins at
screen.
Draw an arrow using graph coordinates that lie outside the axis range

arrow is drawn in the margin, well outside the graph:

set term postscript eps enhanced size 11in,8.5in
set nokey
set border 10
set xtics axis nomirror
set xzeroaxis lt 1
set tmargin at screen 0.412
set bmargin at screen 0.175
set rmargin at screen 0.869
set lmargin at screen 0.112
set arrow from graph 0, first 2.0 to graph 1, first 2.0 nohead lc 1
set out 'Test_arrow_OOB.eps'
plot sin(x)

thanks

panchankos

unread,
Jan 27, 2011, 10:29:24 AM1/27/11
to
> Generated a small plot on a large canvas by specifying the margins at
> screen.
> Draw an arrow using graph coordinates that lie outside the axis range
>

I meant first coordinates (y axis coordinates)

Hans-Bernhard Bröker

unread,
Jan 27, 2011, 2:10:00 PM1/27/11
to
On 27.01.2011 16:26, panchankos wrote:
> Is this expected behavior?

Yes. gnuplot did exactly what you asked it to.

What else did you expect to happen?

sfeam

unread,
Jan 27, 2011, 7:01:06 PM1/27/11
to
panchankos wrote:

> Is this expected behavior?

Yes. You can use "set clip" to control the clipping behaviour of
the plot itself, but that does not apply to separate elements like
labels, arrows, rectangles, etc.

If you want to draw arrows that are clipped to the plot
area, you would have to use a plot command:

plot sin(x), \
'-' using 1:2:3:4 with vectors
x0 y0 xdelta ydelta
e

panchankos

unread,
Jan 28, 2011, 8:44:34 AM1/28/11
to

> Yes.  You can use "set clip" to control the clipping behaviour of
> the plot itself, but that does not apply to separate elements like
> labels, arrows, rectangles, etc.
>
> If you want to draw arrows that are clipped to the plot
> area, you would have to use a plot command:
>
>     plot sin(x), \
>     '-' using 1:2:3:4 with vectors
>          x0 y0 xdelta ydelta
>     e

Yes I was expecting it to clip to the plot I guess :) I did not think
that the axis would continue invisibly to the canvas limits.

Thanks for the hint on using the plot command!

panchankos

unread,
Jan 28, 2011, 10:45:08 AM1/28/11
to
Last question:

Is there any possible way to clip labels to the plot? ie, not show
labels that are positioned outside the plot area?

thanks

sfeam

unread,
Jan 30, 2011, 1:14:44 PM1/30/11
to
panchankos wrote:

Same answer: plot ... with labels

But the clipping is only applied to the anchor point of the label.
I.e., the label is either printed or not printed, it is not
truncated part-way through because it extends beyond the limit
of the plot area.

panchankos

unread,
Jan 31, 2011, 9:55:22 AM1/31/11
to
On Jan 30, 1:14 pm, sfeam <sf...@users.sourceforge.net> wrote:
> Same answer:   plot ... with labels
>
> But the clipping is only applied to the anchor point of the label.
> I.e., the label is either printed or not printed, it is not
> truncated part-way through because it extends beyond the limit
> of the plot area.

Thanks,

I want to specify the label position at a specifc y coord, and on the
right side of the graph, so I was using "label at graph 0.9, first [y-
value]"

"plot with ... labels" puts a label at the x,y coord. If the number of
points on my plot is variable, the x-position of the label will vary
when i plot with different sets of data.

To solve this problem I was able to use the built-in variable
GPVAL_X_MAX and offset from there.

sfeam

unread,
Jan 31, 2011, 11:13:08 AM1/31/11
to
panchankos wrote:

> On Jan 30, 1:14 pm, sfeam <sf...@users.sourceforge.net> wrote:
>> Same answer: plot ... with labels
>>
>> But the clipping is only applied to the anchor point of the label.
>> I.e., the label is either printed or not printed, it is not
>> truncated part-way through because it extends beyond the limit
>> of the plot area.
>
> Thanks,
>
> I want to specify the label position at a specifc y coord, and on the
> right side of the graph, so I was using "label at graph 0.9, first [y-
> value]"

You could maybe use the x2 axis to accomplish the same thing:
set x2range [0:1]

plot 'datafile' with points, '-' using 1:2:3 x2y with labels \
1.0 yval "label contents"
e

panchankos

unread,
Feb 1, 2011, 8:48:59 AM2/1/11
to
On Jan 31, 11:13 am, sfeam <sf...@users.sourceforge.net> wrote:
>
> You could maybe use the x2 axis to accomplish the same thing:
>    set x2range [0:1]
>
>    plot 'datafile' with points, '-' using 1:2:3 x2y with labels \
>        1.0 yval "label contents"
>        e
.
That would work until i needed to use the x2 axis as well on the same
plot.
But if I didn't need the x2 axis, it would be easier to specify the
position, x2range[0:1] becomes like the graph coordinate system.

thanks for the tips!

0 new messages