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

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed May 6 18:25:46 CEST 2015



On 05/06/2015 04:35 PM, Aurelie C.Godin wrote:
> 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?

I'm not sure what you had expected: do you want them to decrease, in
value, from top to bottom? sp::spplot does it the same way stplot does now.

> 
> 
> 
> -----
> 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.
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi),  University of Münster,
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/
Spatial Statistics Society http://www.spatialstatistics.info

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20150506/7a0f5ae5/attachment.bin>


More information about the R-sig-Geo mailing list