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

toka tokas tokkass at yahoo.com
Sun Oct 2 12:36:37 CEST 2005


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




More information about the R-help mailing list