[R] lattice to ggplot2 conversion help
ashz
ashz at walla.co.il
Mon Aug 22 14:42:01 CEST 2011
Hi,
I am interested in ggplot2 and I found this lattice code very interesting
(http://addictedtor.free.fr/graphiques/graphcode.php?graph=48).
Code:
library(lattice)
lattice.options(default.theme = canonical.theme(color = FALSE))
tmp <-
expand.grid(geology = c("Sand","Clay","Silt","Rock"),
species = c("ArisDiff", "BracSera", "CynDact",
"ElioMuti", "EragCurS", "EragPseu"),
dist = seq(1,9,1) )
tmp$height <- rnorm(216)
sp <- list(superpose.symbol = list(pch = 1:6, cex = 1.2),
superpose.line = list(col = "grey", lty = 1))
# print is needed when you source() the file
print(xyplot(height ~ dist | geology, data = tmp,
groups = species,
layout = c(2,2),
panel = function(x, y, type, ...) {
panel.superpose(x, y, type="l", ...)
lpoints(x, y, pch=16, col="white", cex=2)
panel.superpose(x, y, type="p",...)
},
par.settings = sp,
auto.key = list(columns = 2, lines = TRUE)))
I will be very happy if someone can please explain me how to do it in
ggplot2 as it will be great help.
Cheers,
Ashz
--
View this message in context: http://r.789695.n4.nabble.com/lattice-to-ggplot2-conversion-help-tp3760001p3760001.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list