[R] Simple R graph question
Duncan Mackay
mackay at northnet.com.au
Sat Jul 9 00:00:27 CEST 2011
At 07:12 09/07/2011, you wrote:
>Dear jholtman,
>
>Thanks for the reply & sorry for the been unclear before.
>
>My desire graph is to have multiply plots showing Y1,Y2,Y3 with the same X,
>were each plot is month-year (e.g., 5-2001, 6-2001, etc). It ill be great if
>each Y can have a different line and point style.
>
>The Lattice graphic
>(http://addictedtor.free.fr/graphiques/graphcode.php?graph=48) looks similar
>to what I want but the script looks complex for me.
>
>Thanks in advance.
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Simple-R-graph-question-tp3653493p3655142.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>R-help at 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.
Hi ashz
Try the following simplification which incorporates the par.settings
into xyplot
xyplot(height ~ dist | geology, data = tmp,
groups = species,
layout = c(2,2),
auto.key = list(columns = 2, lines = TRUE),
par.settings = list(superpose.symbol = list(pch = 1:6, cex = 1.2),
superpose.line = list(col = "grey", lty = 1)),
panel = function(x, y, type, ...) {
panel.superpose(x, y, type="l", ...)
panel.superpose(x, y, type="p",...)
},
)
which can be further simplified to :
xyplot(height ~ dist | geology, data = tmp,
groups = species,
layout = c(2,2),
auto.key = list(columns = 2, lines = TRUE),
par.settings = list(superpose.symbol = list(pch = 1:6, cex = 1.2),
superpose.line = list(col = "grey", lty = 1)),
panel = function(x, y, type, ...) {
panel.superpose(x, y, type="b", ...)
},
)
or an alternative
xyplot(height ~ dist | geology, data = tmp,
groups = species,
layout = c(2,2),
auto.key = list(columns = 2, lines = TRUE),
par.settings = list(superpose.symbol = list(pch = 1:6, cex = 1.2),
superpose.line = list(col = "grey", lty = 1)),
panel = function(x, y, type, ...) {
panel.superpose(x, y, type="o", ...)
},
)
study
?xyplot
Regards
Duncan Mackay
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email: home mackay at northnet.com.au
More information about the R-help
mailing list