[R] Lattice wireframe or cloud plot with different colours by a group
Pam Allen
allen_pam at hotmail.com
Sat Apr 2 00:21:28 CEST 2011
I have a question about wireframe 3-D plots and how to apply colors. I have
a large dataset of river flow (m^3/s) over time, and I have coded these
flows based on their height. I would like to produce a wireframe plot that
colors the graph based on the flow code, i.e. I would like high flows to be
red, medium to be green and low flows to be blue. Here is some sample data
with the basic wireframe plot:
flow.dat=cbind.data.frame(flow=sin(2*pi/53*c(1:3000))+1,day=as.numeric(format(as.Date(c(1:3000)),
format="%j")), year=as.numeric(format(as.Date(c(1:3000)),
format="%Y")),grp=c(rep(c("1.high","2.med","3.low"),1000)))
wireframe(flow~day*year, data=flow.dat, shade=T)
Is there any way to specify what colours are passed to the plot? I.e.
wireframe(flow~day*year, data=flow.dat, shade=T, groups=grp,
col.group=c("#FF3030","#551A8B","#43CD80"))
I would also be happy if I could do this with a cloud plot, but I can't get
the colors to plot correctly.
cloud(flow~day*year, data=flow.dat, shade=T, groups=grp,
col.group=c("#FF3030","#43CD80","#1E90FF"), pch=20)
Any help is much appreciated! Thank you.
-Pam Allen
allen_pam at hotmail.com
--
View this message in context: http://r.789695.n4.nabble.com/Lattice-wireframe-or-cloud-plot-with-different-colours-by-a-group-tp3421296p3421296.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list