r - assigning colours to plots in lattice according to Set or factor, not groups -



r - assigning colours to plots in lattice according to Set or factor, not groups -

i have lattice plot of experimental info has 4 datasets (i.e. 4 different subsets in "config." below), each dataset subdivided according config , grouped within each test type according wind direction, "dir". able set shape of points according grouping "dir" across plots cannot set colours according "config" illustration first plot has reddish points, sec plot has bluish points etc. using xyplot in lattice , code plot is:

xyplot(ach[,"f"]~ach[,"ar_sqrt"] | config., type=c("p"),ach, groups=dir, auto.key=list(true, space="bottom", columns=4, padding.text=(8)), outer=true, allow.multiple=true, as.table=true, scales=list(tick.number=10), grid=true, par.settings=simpletheme(pch=points$shape, cex=1.75, col=1), abline=list(c(0,0.2013), col=2, type="l"), layout=c(1,4), panel = function( x,y,...) { panel.abline(lm(y~x),col = "black", lwd=1) panel.xyplot( x,y,...) })

i cant attach image rep les sthan 10, apologies. have come across different ways of setting colours, etc seem either utilize grouping function.

the info set available here, (i added columns pch , col seek , utilize no avail:

https://www.dropbox.com/sh/ug9kun9rycsb1fw/aabsxums9kewsgeeactyhdkxa

any help or direction duplicates didnt find much appreciated...

this best accomplished using panel.number(), gives access, within phone call custom panel function, index of panel beingness plotted.

here's simple reproducible example:

library(lattice) lattice.options(default.theme = standard.theme(color = false)) colors = c("blue", "gold", "red", "green", "black", "grey") xyplot(mpg ~ disp | carb, info = mtcars, panel = function(x,y,...) { panel.xyplot(x, y, col=colors[panel.number()], pch=16, ...) })

a couple more involved examples given here , here.

r plot lattice

Comments

Popular posts from this blog

ruby on rails - Devise Logout Error in RoR -

model view controller - MVC Rails Planning -

php - Working with pretty urls on apache and fastcgi after hhvm installation -