Re: [R] plot question when type = "b" and pch is a vector

From: John Fox <jfox_at_mcmaster.ca>
Date: Sun 02 Oct 2005 - 23:18:38 EST


Dear tokas,

How about:

x <- seq(0.01, 10, length = 20)
xx <- x[7]
x[7] <- NA

plot(c(0, 10), c(-20, 20), type = "n", xlab = "x",

        ylab = expression(2 * alpha * log(x))) for(i in 1:4){

    lines(x, 2 * i * log(x), lty = 1)
    text(xx, 2 * i * log(xx), i)
    }

I hope this helps,
 John



John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of toka tokas
> Sent: Sunday, October 02, 2005 5:37 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] plot question when type = "b" and pch is a vector
>
> Dear R users,
>
> I've been struggling some days with the following
> problem: I'm interesting in producing the following plot
>
> x <- seq(0.01, 10, length = 20)
>
> plot(c(0, 10), c(-20, 20), type = "n", xlab = "x",
> ylab = expression(2 * alpha * log(x)))
>
> pch. <- rep(NA, length(x))
> for(i in 1:4){
> pch.[7] <- as.character(i)
> lines(x, 2 * i * log(x), type = "b", pch = pch., lty = 1) }
>
> where all the line segments are connected, except from the
> 7th one where I've put the value of alpha -- in other words
> I'd like to produce a line plot where the label appears at
> each line with some white space around it.
>
> thanks in advance,
> tokas
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Oct 02 23:23:39 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:08:41 EST