Skip to content

Stplot for discrete data

3 messages · Katharine Walter, Edzer Pebesma

#
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,
#
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:

  
    
#
(not entirely woken up it seems: I meant "stfdf" where I wrote "stplot")
On 06/04/2015 12:44 PM, Edzer Pebesma wrote: