[R] how to draw a vertical line from points to x-axis

Nair, Murlidharan T mnair at iusb.edu
Mon Sep 8 19:18:48 CEST 2008


Anny,
You can also do the following

plot(0:10, 0:10, pch=16, type="h")

Cheers../Murli


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Peter Alspach
Sent: Sunday, September 07, 2008 5:10 PM
To: Anny Huang; r-help at r-project.org
Subject: Re: [R] how to draw a vertical line from points to x-axis

Anny

Here's one way:

plot(0:10, 0:10, pch=16)
lines(rep(0:10, each=3), t(matrix(c(0:10, rep(c(0,NA), each=11)),
ncol=3)))

HTH ....

Peter Alspach


> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Anny Huang
> Sent: Monday, 8 September 2008 8:49 a.m.
> To: r-help at r-project.org
> Subject: [R] how to draw a vertical line from points to x-axis
>
> Hello,
>
> I want to know how to draw a line connecting each point to
> the x-axis perpendicularly (i.e. a vertical line).
> abline(v=...) seems not to work for my purpose, because it
> runs over the data point. Can anyone help? Thanks.
>
> Anny
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

The contents of this e-mail are privileged and/or confid...{{dropped:13}}



More information about the R-help mailing list