[R-sig-Geo] stplot - legend/classes of categorical vairable

Aurelie C.Godin godina at dal.ca
Wed May 6 16:35:18 CEST 2015


I'm getting strange behavior in the bar legend with factors ...
I cut my data into intervals and plotted results using stplot, however now
the levels are not appearing in the same order as levels(factor)...?

For example, I get the same problem here:
library(spacetime)
example(STFDF)
set.seed(42) 
gridded(stfdf at sp) = TRUE 
stfdf$f = factor(sample(c("a", "b", "c"), 12, replace = TRUE))
levels(stfdf$f)
levels(stfdf$f)<-c('0','(0,5]','(5,25]')
levels(stfdf$f)
library(RColorBrewer)
stplot(stfdf[,,"f"], col.regions = brewer.pal(3, "Accent")) 

Thoughts on how to fix this?



-----
Aurelie Cosandey-Godin
Ph.D. Student, Department of Biology, Dalhousie University
Industrial Graduate Fellow, WWF-Canada
Email: godina at dal.ca | Web: wormlab.biology.dal.ca

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/stplot-legend-classes-of-categorical-vairable-tp7587860p7588200.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list