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

Skip plotting a certain range on a line plot

2 views
Skip to first unread message

Yipkei Kwok

unread,
Oct 28, 2009, 6:25:44 PM10/28/09
to
Hi,

Say, I have 2 lines to plot on a line plot and the data of both lines
are store in the same data file. The range of the x-axis is from 0 to
10 (integer). For line 1, I want to plot the whole range from 0 to 10.
For line 2, I only want to plot from 0 to 3, and from 7 to 10.

I think I can do it by separating the data of the 2 lines into 2
different data files.

How else can I do it?

Thank you!

Zoltan

unread,
Oct 29, 2009, 12:32:14 PM10/29/09
to

There are two ways of doing this. If you know the number of data
points in your file, and know at which position 3 and 7 is, you can
use the every keyword to specify which data points you actually want
to plot. Since you have integers between 0 and 10, this applies to
your data set. Then
plot 'foo' u 0:1 ev ::0::7 w l
should do the trick.
If this is not the case, you can define a function that return 1/0, if
not in the range. Something like this:
f(x,y)=(x<3?y:1/0)
and then
plot 'foo' u 0:1, '' u 0:(f($0,$1))
Cheers,
Zoltán

0 new messages