problem with using lines command on windows XP machine

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with using lines command on windows XP machine

Commandeur
Hello,

I'm using R version 2.2.0 installed on windows XP machine, with SP2 (maybe
it's also interesting to note it's laptop, so it outputs to a laptop screen)
a l and I wanted to draw a line in a graph, but it does not seem to work.

To test it I use the following code:

x = c(-1,0,1)
y = c(-1,0,1)
plot(x,y, type="l", xlim=c(-1,1), ylim=c(-1,1))
lines(0)

If I understand the documentation right this should draw a line (with
default settings, I'm not setting any parameters) at x=0.

I tried goofing around a bit setting linewidth and color differently, I
tried using xy.coords etc, but no line appeared in the graph.

The commands abline and segments work perfectly fine (so I am now using
segments to plot the line I want), but I still think the lines command
should work.

Does anybody has similar problems drawing lines on XP machines (or laptops
in general?)? Or I am doing something abominably wrong?

Greetings and thanks in advance for any replies,
Edwin Commandeur

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: problem with using lines command on windows XP machine

Dimitris Rizopoulos
I think  you need "abline(v = 0)".

I hope it helps.

Best,
Dimitris


----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message -----
From: "Edwin Commandeur" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, January 05, 2006 11:27 AM
Subject: [R] problem with using lines command on windows XP machine


> Hello,
>
> I'm using R version 2.2.0 installed on windows XP machine, with SP2
> (maybe
> it's also interesting to note it's laptop, so it outputs to a laptop
> screen)
> a l and I wanted to draw a line in a graph, but it does not seem to
> work.
>
> To test it I use the following code:
>
> x = c(-1,0,1)
> y = c(-1,0,1)
> plot(x,y, type="l", xlim=c(-1,1), ylim=c(-1,1))
> lines(0)
>
> If I understand the documentation right this should draw a line
> (with
> default settings, I'm not setting any parameters) at x=0.
>
> I tried goofing around a bit setting linewidth and color
> differently, I
> tried using xy.coords etc, but no line appeared in the graph.
>
> The commands abline and segments work perfectly fine (so I am now
> using
> segments to plot the line I want), but I still think the lines
> command
> should work.
>
> Does anybody has similar problems drawing lines on XP machines (or
> laptops
> in general?)? Or I am doing something abominably wrong?
>
> Greetings and thanks in advance for any replies,
> Edwin Commandeur
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: problem with using lines command on windows XP machine

PIKAL Petr
In reply to this post by Commandeur
Hi

On 5 Jan 2006 at 11:27, Edwin Commandeur wrote:

From:           "Edwin Commandeur" <[hidden email]>
To:             <[hidden email]>
Date sent:       Thu, 5 Jan 2006 11:27:01 +0100
Subject:         [R] problem with using lines command on windows XP machine

> Hello,
>
> I'm using R version 2.2.0 installed on windows XP machine, with SP2
> (maybe it's also interesting to note it's laptop, so it outputs to a
> laptop screen) a l and I wanted to draw a line in a graph, but it does
> not seem to work.
>
> To test it I use the following code:
>
> x = c(-1,0,1)
> y = c(-1,0,1)
> plot(x,y, type="l", xlim=c(-1,1), ylim=c(-1,1))
> lines(0)

quite close

abline(v=0)

draws a vertical line at x=0

from help page
Arguments:

    x, y: coordinate vectors of points to join.

Maybe to mention abline in See also of lines help page could be good

HTH
Petr



>
> If I understand the documentation right this should draw a line (with
> default settings, I'm not setting any parameters) at x=0.
>
> I tried goofing around a bit setting linewidth and color differently,
> I tried using xy.coords etc, but no line appeared in the graph.
>
> The commands abline and segments work perfectly fine (so I am now
> using segments to plot the line I want), but I still think the lines
> command should work.
>
> Does anybody has similar problems drawing lines on XP machines (or
> laptops in general?)? Or I am doing something abominably wrong?
>
> Greetings and thanks in advance for any replies,
> Edwin Commandeur
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
[hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: problem with using lines command on windows XP machine

Commandeur
Hi Petr and Eric,

Thanks for your comments.

To plot a vertical line, using "lines(0)" does not work, but

lines(c(-1,0),c(0,1))

does the work in my simple test example. I just interpreted the ?lines
documentation wrong.

So the "lines" command does work on my pc. Off course "abline(v=0)" will
also do the job in this specific example...

Sorry for the trouble,

Edwin

-----Original Message-----
From: Petr Pikal [mailto:[hidden email]]
Sent: donderdag 5 januari 2006 13:32
To: Edwin Commandeur; [hidden email]
Subject: Re: [R] problem with using lines command on windows XP machine


Hi

On 5 Jan 2006 at 11:27, Edwin Commandeur wrote:

From:           "Edwin Commandeur" <[hidden email]>
To:             <[hidden email]>
Date sent:       Thu, 5 Jan 2006 11:27:01 +0100
Subject:         [R] problem with using lines command on windows XP machine

> Hello,
>
> I'm using R version 2.2.0 installed on windows XP machine, with SP2
> (maybe it's also interesting to note it's laptop, so it outputs to a
> laptop screen) a l and I wanted to draw a line in a graph, but it does
> not seem to work.
>
> To test it I use the following code:
>
> x = c(-1,0,1)
> y = c(-1,0,1)
> plot(x,y, type="l", xlim=c(-1,1), ylim=c(-1,1))
> lines(0)

quite close

abline(v=0)

draws a vertical line at x=0

from help page
Arguments:

    x, y: coordinate vectors of points to join.

Maybe to mention abline in See also of lines help page could be good

HTH
Petr



>
> If I understand the documentation right this should draw a line (with
> default settings, I'm not setting any parameters) at x=0.
>
> I tried goofing around a bit setting linewidth and color differently,
> I tried using xy.coords etc, but no line appeared in the graph.
>
> The commands abline and segments work perfectly fine (so I am now
> using segments to plot the line I want), but I still think the lines
> command should work.
>
> Does anybody has similar problems drawing lines on XP machines (or
> laptops in general?)? Or I am doing something abominably wrong?
>
> Greetings and thanks in advance for any replies,
> Edwin Commandeur
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
[hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: problem with using lines command on windows XP machine

Liaw, Andy
In reply to this post by Commandeur
lines() connects the `dots' given.  If you want straight lines spanning the
entire graph, you are better off with abline().

Andy

From: Edwin Commandeur

>
> Hi Petr and Eric,
>
> Thanks for your comments.
>
> To plot a vertical line, using "lines(0)" does not work, but
>
> lines(c(-1,0),c(0,1))
>
> does the work in my simple test example. I just interpreted the ?lines
> documentation wrong.
>
> So the "lines" command does work on my pc. Off course
> "abline(v=0)" will
> also do the job in this specific example...
>
> Sorry for the trouble,
>
> Edwin
>
> -----Original Message-----
> From: Petr Pikal [mailto:[hidden email]]
> Sent: donderdag 5 januari 2006 13:32
> To: Edwin Commandeur; [hidden email]
> Subject: Re: [R] problem with using lines command on windows
> XP machine
>
>
> Hi
>
> On 5 Jan 2006 at 11:27, Edwin Commandeur wrote:
>
> From:           "Edwin Commandeur" <[hidden email]>
> To:             <[hidden email]>
> Date sent:       Thu, 5 Jan 2006 11:27:01 +0100
> Subject:         [R] problem with using lines command on
> windows XP machine
>
> > Hello,
> >
> > I'm using R version 2.2.0 installed on windows XP machine, with SP2
> > (maybe it's also interesting to note it's laptop, so it outputs to a
> > laptop screen) a l and I wanted to draw a line in a graph,
> but it does
> > not seem to work.
> >
> > To test it I use the following code:
> >
> > x = c(-1,0,1)
> > y = c(-1,0,1)
> > plot(x,y, type="l", xlim=c(-1,1), ylim=c(-1,1))
> > lines(0)
>
> quite close
>
> abline(v=0)
>
> draws a vertical line at x=0
>
> from help page
> Arguments:
>
>     x, y: coordinate vectors of points to join.
>
> Maybe to mention abline in See also of lines help page could be good
>
> HTH
> Petr
>
>
>
> >
> > If I understand the documentation right this should draw a
> line (with
> > default settings, I'm not setting any parameters) at x=0.
> >
> > I tried goofing around a bit setting linewidth and color
> differently,
> > I tried using xy.coords etc, but no line appeared in the graph.
> >
> > The commands abline and segments work perfectly fine (so I am now
> > using segments to plot the line I want), but I still think the lines
> > command should work.
> >
> > Does anybody has similar problems drawing lines on XP machines (or
> > laptops in general?)? Or I am doing something abominably wrong?
> >
> > Greetings and thanks in advance for any replies,
> > Edwin Commandeur
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
>
> Petr Pikal
> [hidden email]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html