[R] How to generate 'minor' ticks in lattice (qqmath)
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Jan 24 14:42:30 CET 2007
I think you have a stray trellis.focus statement (just before
the qqmath statement). Probably a cut and paste problem.
Regards.
On 1/24/07, Helmut Schütz <helmut.schuetz at bebac.at> wrote:
> Dear Gabor!
>
> thanks for your hints; as a side-effect I learned a lot about lattice.
>
> The working example is:
>
> library("lattice")
> library("grid")
> numy <- 100
> y <- runif(numy,min=0,max=1)
> sig <- 0.05
> numsig <- length(which(y<sig))
>
> Lower <- 0
> Upper <- 1
> MajorInterval <- 5 # interval for major ticks
> MinorInterval <- 4 # interval within major
> Major <- seq( Lower,Upper,(Upper-Lower)/MajorInterval )
> Minor <- seq( Lower,Upper,(Upper-Lower)/(MajorInterval*MinorInterval) )
> labl <- as.character(Major)
>
> trellis.focus("panel", 1, 1, clip.off = TRUE)
> qqmath(y, distribution = qunif,
> prepanel = NULL,
> panel = function(x)
> {
> panel.abline(c(0,1), lty = 2)
> panel.polygon(c(0,0,numsig/numy,numsig/numy,0), c(0,sig,sig,0,0),
> lwd = 0.75)
> panel.qqmath(x, distribution = qunif, col = 1)
> },
> scales=list(x = list(at = Major), y = list(at = Major), tck=c(1,0),
> labels=labl, cex=0.9),
> xlab = "uniform [0,1] quantiles",
> ylab = "runif [0,1]",
> min = 0, max = 1)
> trellis.focus("panel", 1, 1, clip.off = TRUE)
> panel.axis("bottom", check.overlap = TRUE, outside = TRUE, labels =
> FALSE, tck = .5, at = Minor)
> panel.axis("left", check.overlap = TRUE, outside = TRUE, labels = FALSE,
> tck = .5, at = Minor)
> trellis.unfocus()
>
> Best regards,
> Helmut
>
> --
> Helmut Schütz
> BEBAC
> Consultancy Services for Bioequivalence and Bioavailability Studies
> Neubaugasse 36/11
> 1070 Vienna/Austria
> tel/fax +43 1 2311746
> Web http://BEBAC.at
> BE/BA Forum http://forum.bebac.at
> http://www.goldmark.org/netrants/no-word/attach.html
>
>
>
More information about the R-help
mailing list