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

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed May 6 19:04:50 CEST 2015



On 05/06/2015 06:51 PM, Aurelie C.Godin wrote:
> 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.
> In the key with factor c("a", "b", "c”), “a" appears at the bottom, followed by “b" and “c” (bottom to top), but when these are changed for c('0','(0,5]','(5,25]') , then their order in the key are different e.g., “a" = “0” is appearing at the top rather than the bottom and the key is not in order i.e., now from bottom to top: (0,5], (5,25] , 0.
> 

I can't reproduce this; what is your sessionInfo()? Maybe updating
spacetime helps?

> I’m not sure what you mean by :
> sp::spplot does it the same way stplot does now.
> 
> On May 6, 2015, at 1:27 PM, edzer [via R-sig-geo] <ml-node+s2731867n7588201h68 at n2.nabble.com<mailto:ml-node+s2731867n7588201h68 at n2.nabble.com>> wrote:
> 
> 
> 
> 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: [hidden email]<x-msg://2/user/SendEmail.jtp?type=node&node=7588201&i=0> | Web: wormlab.biology.dal.ca<http://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<http://Nabble.com>.
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]<x-msg://2/user/SendEmail.jtp?type=node&node=7588201&i=1>
>> 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<http://www.spatialstatistics.info/>
> 
> 
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]<x-msg://2/user/SendEmail.jtp?type=node&node=7588201&i=2>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 
> [http://r-sig-geo.2731867.n2.nabble.com/images/icon_attachment.gif] signature.asc (501 bytes) Download Attachment<http://r-sig-geo.2731867.n2.nabble.com/attachment/7588201/0/signature.asc>
> 
> 
> ________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://r-sig-geo.2731867.n2.nabble.com/stplot-legend-classes-of-categorical-vairable-tp7587860p7588201.html
> To unsubscribe from stplot - legend/classes of categorical vairable, click here<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7587860&code=Z29kaW5hQGRhbC5jYXw3NTg3ODYwfDE5MzkwMjI1NTk=>.
> NAML<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> 
> 
> --
> 
> Aurelie Cosandey-Godin, PhD
> Dalhousie University, Department of Biology
> godina at dal.ca<mailto:godina at dal.ca> | m: +1 902 499-0984
> 
> 
> 
> 
> 
> -----
> Aurelie Cosandey-Godin, Ph.D.
> Postdoctoral Research Fellow, Department of Biology, Dalhousie University
> godina at dal.ca | wormlab.biology.dal.ca
> 
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/stplot-legend-classes-of-categorical-vairable-tp7587860p7588202.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/b14c7c29/attachment.bin>


More information about the R-sig-Geo mailing list