It is perhaps not entirely clear from ?update, but update replaces your original lattice call with your new call and re-drawsthe plot. This means that the panel function used for the update() plot is the one in update(), which only draws the line. That's why you see no points.
Obviously, then, you need to include both points and abline in your panel call to get both. However, if you would like to follow the strategy that you have indicated, you can do so by using the layer() functionality in the lattceExtra package, in which you would do something similar to what you have shown. library(latticeExtra) ## after you have installed it from CRAN, possibly ?layer for further info. Your numerous other questions can be answered by close reading of the ?xyplot Help file and/or adding additional functionality to your panel call. For example, text can be added via the panel.text() function. ?lattice will get you info on this and other low level graphics functionality, as well as references to consult. I would also suggest Deepayan Sarkar's book, if you intend to use lattice seriously. Cheers, Bert On Wed, Jun 1, 2011 at 10:00 AM, maxbre <mbres...@arpa.veneto.it> wrote: > Hello R experts, > > what follows is my reproducible example: > > mydata<-structure(list(ped.avg = c(335.9, 110.8, 645.7, 638.9, 1468.1, > 126.4, 4811.1, 88.5, 868.5, 656.6, 723.6, 654, 2.8, 15, 14.2, > 17.5, 15.4, 112.1, 424.7, 18.3, 19.9, 28.6, 25.6, 23.5, 15.4, > 27, 62.1, 15.6, 74.6), ped.erst = c(96, 53.2, 615.2, 616.5, 512.9, > 56.2, 1851.8, 57.1, 579.5, 613.2, 601.1, 613.6, 1.3, 6.3, 6.5, > 6.1, 6.3, 42, 166.4, 6.5, 6.5, 7.6, 8, 7, 6.3, 8.8, 24.6, 6.3, > 35.6), tv.avg = c(670.4, 320, 282.4, 266.6, 2077.3, 383.1, 7116, > 335.1, 642.9, 291, 405.1, 280.8, 5, 18.5, 16.5, 28.6, 24.8, 150.2, > 366, 40.3, 38.4, 51.9, 52.9, 48.1, 27.8, 73.8, 168.3, 32.8, 151.2 > ), tv.erst = c(233.8, 243.4, 245.9, 246.4, 389.9, 240.4, 1530.7, > 242.8, 232.4, 245.1, 239.7, 245.7, 2.2, 6.9, 6, 11.5, 9.5, 69.5, > 139.5, 17.9, 16.7, 22.9, 27.3, 24.5, 12.7, 46.3, 102.2, 15.7, > 71.2), family = structure(c(1L, 1L, 1L, 1L, 5L, 5L, 5L, 5L, 5L, > 5L, 5L, 5L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 20L, 20L, 20L, > 20L, 20L, 20L, 20L, 20L, 20L, 20L), .Label = c("non-orto PCB", > "non-orto PCB", "non-orto PCB", "non-orto PCB", "mono-orto PCB", > "mono-orto PCB", "mono-orto PCB", "mono-orto PCB", "mono-orto PCB", > "mono-orto PCB", "mono-orto PCB", "mono-orto PCB", "PCDD", "PCDD", > "PCDD", "PCDD", "PCDD", "PCDD", "PCDD", "PCDF", "PCDF", "PCDF", > "PCDF", "PCDF", "PCDF", "PCDF", "PCDF", "PCDF", "PCDF"), class = "factor"), > name = structure(c(28L, 29L, 22L, 26L, 18L, 19L, 20L, 21L, > 23L, 24L, 25L, 27L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, > 11L, 12L, 13L, 14L, 15L, 16L, 17L), .Label = c("D4", "D5", > "D6a", "D6b", "D6c", "D7", "D8", "F4", "F5a", "F5b", "F6a", > "F6b", "F6c", "F6d", "F7a", "F7b", "F8", "P105", "P114", > "P118", "P123", "P126", "P156", "P157", "P167", "P169", "P189", > "P77", "P81"), class = "factor"), ped.lower = c(239.9, 57.6, > 30.5, 22.400, 955.2, 70.2, 2959.3, 31.4, 289, 43.4, 122.5, > 40.4, 1.5, 8.7, 7.7, 11.4, 9.1, 70.1, 258.3, 11.8, 13.4, > 21, 17.6, 16.5, 9.1, 18.2, 37.5, 9.3, 39), ped.upper = c(431.9, > 164, 1260.9, 1255.4, 1981, 182.6, 6662.9, 145.6, 1448, 1269.8, > 1324.7, 1267.6, 4.1, 21.3, 20.7, 23.6, 21.7, 154.1, 591.1, > 24.8, 26.4, 36.2, 33.6, 30.5, 21.7, 35.8, 86.7, 21.9, 110.2 > ), tv.lower = c(436.6, 76.6, 36.5, 20.2, 1687.4, 142.7, 5585.3, > 92.3, 410.5, 45.9, 165.4, 35.1, 2.8, 11.6, 10.5, 17.1, 15.3, > 80.7, 226.5, 22.4, 21.7, 29, 25.6, 23.6, 15.1, 27.5, 66.1, > 17.1, 80), tv.upper = c(904.2, 563.4, 528.3, 513, 2467.2, > 623.5, 8646.7, 577.9, 875.3, 536.1, 644.8, 526.5, 7.2, 25.4, > 22.5, 40.1, 34.3, 219.7, 505.5, 58.2, 55.1, 74.8, 80.2, 72.6, > 40.5, 120.1, 270.5, 48.5, 222.4)), .Names = c("ped.avg", > "ped.erst", "tv.avg", "tv.erst", "family", "name", "ped.lower", > "ped.upper", "tv.lower", "tv.upper"), row.names = c(NA, -29L), class = > "data.frame") > > > and this is the code I worked so far (in order to clear out what is the > final result I would like to get) > > mydata$family <- factor(mydata$family, levels=as.character(mydata$family)) > > library(lattice) > > myplot<-xyplot(ped.avg ~ tv.avg | family, > data=mydata, > strip=strip.custom(bg='white'), col.line=1, main="title", > xlab="tv [fg/m3]", ylab="ped [fg/m3]", > scales= list(x=list(relation="free", log=TRUE), > y=list(relation="free", > log=TRUE)), > ) > > update(myplot, > xlim=list(c(1.9,3),c(2,3.8),c(0.5,2.7),c(1.2,2.4)), > ylim=list(c(1.9,3),c(2,3.8),c(0.5,2.7),c(1.2,2.4)), > cex=0.6, aspect="iso", > panel=function(...){ > panel.abline(a=0, b=1, lty=1, col=1) > } > ) > > obviously there is something wrong in the resulting chart and therefore > these are my questions: > > 1- how to draw a diagonal lines in each of the panels without “deleting” > points? (in my example the use of panel.abline is somehow getting rid of the > points) > 2- how to label points with the “name”? (no clue for this) > 3- how to draw error bar points referring of both x and y axes? (no clue > for > this) > 4- how to format axes tickmark labels with a scientific notation? (no > clue > for this) > 5- how to list all these commands inside xyplot() without the need to use > update()? (for some reasons I do not fully understand I can not ‘move’ all > commands inside the main plotting– xyplot() - without loosing some relevant > features of the chart) > > any help much appreciated > sorry for such trivial question but I’m using R since a very short time: > please keep your replies as much simple and self explanatory as possible > thank you > > maxbre > > > -- > View this message in context: > http://r.789695.n4.nabble.com/lattice-panel-fine-control-tp3566347p3566347.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org 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. > -- "Men by nature long to get on to the ultimate truths, and will often be impatient with elementary studies or fight shy of them. If it were possible to reach the ultimate truths without the elementary studies usually prefixed to them, these would not be preparatory studies but superfluous diversions." -- Maimonides (1135-1204) Bert Gunter Genentech Nonclinical Biostatistics ______________________________________________ R-help@r-project.org 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.