Re: [R] How to generate 'minor' ticks in lattice (qqmath)

From: Helmut Schütz <helmut.schuetz_at_bebac.at>
Date: Wed 24 Jan 2007 - 12:41:29 GMT

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

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.
Received on Wed Jan 24 23:49:31 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 Jan 2007 - 02:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.