Is it a way to make plots with vertical lines, like plot(x, y,
type="h"),
but starting from a different value than y=0.
For example, with x=1:3, y=-(1:3), y.orig=-3 :
-1 |
|
y -2 | |
| |
-3 | | |
1 2 3
x
Thanks
--
Cyril Humbert
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Cyril Humbert <humbertc at univ-mlv.fr> writes:> Is it a way to make plots with vertical lines, like plot(x, y, type="h"), > but starting from a different value than y=0. > > For example, with x=1:3, y=-(1:3), y.orig=-3 : > > -1 | > | > y -2 | | > | | > -3 | | | > 1 2 3 > x >You might subtract y.orig from the data and add it to the axis labels.... -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA wrote:> > Cyril Humbert <humbertc at univ-mlv.fr> writes: > > > Is it a way to make plots with vertical lines, like plot(x, y, type="h"), > > but starting from a different value than y=0. > > > > For example, with x=1:3, y=-(1:3), y.orig=-3 : > > > > -1 | > > | > > y -2 | | > > | | > > -3 | | | > > 1 2 3 > > x > > > > You might subtract y.orig from the data and add it to the axis labels....Or see ?segments: plot(x, y, type="n") segments(x, y, x, y.orig) Uwe Ligges -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear Cyril,
You might try something like the following:
vlines <- function(x, y, y.orig){
plot(range(x), range(c(y, y.orig)), type='n',
xlab=deparse(substitute(x)), ylab=deparse(substitute(y)))
for (i in seq(along=x))lines(x[c(i,i)], c(y.orig, y[i]))
}
vlines(1:3, y=-(1:3), y.orig=-3)
Note that the third line in your example has zero length.
I hope that this helps,
John
On Thu, 27 Jun 2002, Cyril Humbert wrote:
> Is it a way to make plots with vertical lines, like plot(x, y,
type="h"),
> but starting from a different value than y=0.
>
> For example, with x=1:3, y=-(1:3), y.orig=-3 :
>
> -1 |
> |
> y -2 | |
> | |
> -3 | | |
> 1 2 3
> x
>
> Thanks
> --
> Cyril Humbert
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Reasonably Related Threads
- xyplot(y~x, type="l") with missing values (NA)
- hitting ^C breaks readline history (PR#1606)
- Re: (PR#7005) X11 , plot(...expression(...)): missing parentheses
- Re: (PR#7005) X11 , plot(...expression(...)): missing parentheses
- Bug list summary (automatic post)