Hi, I am trying to use the spacetime package to plot a timeseries of discrete data. My dataset consists of the values: 0, 1, NA. Is there a way to plot each value in a different color and construct a key indicating these discrete values? I am plotting with the following command which automatically generates a color ramp from 0 to 1: stplot(stfdf[,,"report"], names.attr=year). Thank you for your help and for providing an excellent package. Best,
Stplot for discrete data
3 messages · Katharine Walter, Edzer Pebesma
try converting variable report into a factor, by stplot$report = factor(stfdf$report) and give them meaningful levels if you want to see those in the legend. The NA values will be missing from the plot, intentionally; if you'd want to see them, give them another value before conversion to factor, e.g. by: stplot$report[is.na(stplot$report)] = 2
On 06/03/2015 11:34 PM, Katharine Walter wrote:
Hi, I am trying to use the spacetime package to plot a timeseries of discrete data. My dataset consists of the values: 0, 1, NA. Is there a way to plot each value in a different color and construct a key indicating these discrete values? I am plotting with the following command which automatically generates a color ramp from 0 to 1: stplot(stfdf[,,"report"], names.attr=year). Thank you for your help and for providing an excellent package. Best, [[alternative HTML version deleted]]
_______________________________________________ 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/20150604/14f0d3c9/attachment.bin>
(not entirely woken up it seems: I meant "stfdf" where I wrote "stplot")
On 06/04/2015 12:44 PM, Edzer Pebesma wrote:
try converting variable report into a factor, by stplot$report = factor(stfdf$report) and give them meaningful levels if you want to see those in the legend. The NA values will be missing from the plot, intentionally; if you'd want to see them, give them another value before conversion to factor, e.g. by: stplot$report[is.na(stplot$report)] = 2 On 06/03/2015 11:34 PM, Katharine Walter wrote:
Hi, I am trying to use the spacetime package to plot a timeseries of discrete data. My dataset consists of the values: 0, 1, NA. Is there a way to plot each value in a different color and construct a key indicating these discrete values? I am plotting with the following command which automatically generates a color ramp from 0 to 1: stplot(stfdf[,,"report"], names.attr=year). Thank you for your help and for providing an excellent package. Best, [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________ 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/20150604/75d7c99c/attachment.bin>