[R] plot control

Alexander Nervedi alexnerdy at hotmail.com
Mon Apr 24 08:53:21 CEST 2006


Dear R gurus,

I'd like to plot a distribution with the tickmarks always at the quantiles 
of the y-axis, as opposed to the quantiles of the distribution I am 
plotting. plot seems to place these ticks based on some calculations that I 
cant see (?plot doesnt show the innards of plot).

Below is some functional code, but the tick marks are placed unattractively 
since I am referencing the quantiles of the distribution. I'd ideally like 
the tickmarks to be able to reference fixed points on the y-axis and the 
show the associted values.

I'd be very grateful for ideas, suggestion and leads.

- alex.

# some code

y1<-rnorm(100)
y2<-runif(100)
x <-1:100

l <-length(y1)
mat<-scale(cbind(y1,y2))

plot(x, mat[,1], col = "blue", yaxt = "n", ylab="")
    axis(2, at = sort(mat[,1])[c(0.25*l,0.5*l,0.75*l)],
            labels = round(sort(y1)[c(0.25*l, 0.5*l,0.75*l)],2))

    points(x, mat[,2], col = "red")
    axis(4, at = sort(mat[,2])[c(0.25*l,0.4*l,0.75*l)],
            labels = round(sort(y2)[c(0.25*l, 0.5*l,0.75*l)],2))




More information about the R-help mailing list