[R] plot control
michael.dondrup at cebitec.uni-bielefeld.de
Mon Apr 24 11:05:11 CEST 2006
it's not quite clear to me, what you are trying to accomplish with this. You
are referring to quantiles (you means quartiles in your case?,
see ?quantile ). So, are you trying to compare theoretical quantiles of a
distribution to the empirical quantiles? Or are you just trying to split the
left axes into 4 ticks? For the first case, try something like:
> y <- rnorm(100)
> y.right.axisticks <- quantile(y)
> y.left.ticks <- qnorm(c(0.25,0.5,0.75)) #makes no sense to compare with
> # theor. quantiles of uniform distribution, right? ;)
or for the latter:
> yrange <- range(y)
> y.left.ticks <- seq(yrange, yrange, (yrange - yrange)/4)
is that, what you thought of?
for another way to compare quantiles
Am Monday 24 April 2006 08:53 schrieb Alexander Nervedi:
> 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
> x <-1:100
> l <-length(y1)
> 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))
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide!
More information about the R-help