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

draw a simple line y=3

2,033 views
Skip to first unread message

.Martin.

unread,
Nov 8, 2009, 9:38:26 AM11/8/09
to
Hi all,
I'm new to gnuplot and would like to know how to draw a straight line
y=3. I've already managed to embed graphs into LaTeX using epslatex
terminal. I've been trying to find it on the internet, but in all of the
tutorials I've seen the examples are with sin/cos etc. I need a straight
line with the intercept point y=3.
Also, how would I provide a few points in the plain and tell gnuplot to
draw a line through some of them?
I do appreciate your help

regards
Martin

Zoltan

unread,
Nov 8, 2009, 10:40:22 AM11/8/09
to
> I'm new to gnuplot and would like to know how to draw a straight line
> y=3.

plot 3
should do just that.

> Also, how would I provide a few points in the plain and tell gnuplot to
> draw a line through some of them?

I believe, this problem is a bit ill-defined. Suppose you have this
data file
# x y
1 1
1.4 5
2.0 3
3.0 2

If you want to draw a line through (1.4, 5) and (3.0, 2) you can say
set arrow 1 from 1.4, 5 to 3.0, 2 nohead
or you could say
f(x) = x*(2.0-5.0)/1.6 + 1.4
plot f(x)

It's not clear how you want to choose the points across which you lay
your line.
Cheers,
Zoltán

.Martin.

unread,
Nov 8, 2009, 11:17:11 AM11/8/09
to
> Zolt�n

Thanks Zoltan,
That's exactly what I meant. I'll give it a try now

regards
Martin

0 new messages