Skip to content

coplot using Date object (PR#8147)

2 messages · mwtoews at sfu.ca, Brian Ripley

#
Full_Name: Michael Toews
Version: 2.1.1
OS: WinXP (SP2)
Submission from: (NULL) (142.58.206.114)


This is a simple feature request concerning the display of the axis in the
coplot function.
Consider an arbritrary set of values from 1990-1999:

date <- as.Date(paste(rep(1990:1999,each=365),1:365),"%Y %j")
mon <- factor(months(date,T),levels=month.abb)
value <- runif(3650)

# Now create coplot for each month:
coplot(value ~ date | mon)

# The resulting date on the x-axis is not like the axis produced from:
plot(value ~ date)
#
On Tue, 20 Sep 2005 mwtoews at sfu.ca wrote:

            
Why do you expect it to be?  plot() is generic, and coplot() is not: 
plot(value ~ date) is just a round-the-houses way to generate the call 
plot(date, value) (and that is why it happens to work with Date objects).

Think of coplot() as a limited predecessor of lattice graphics, which also 
precedes class "Date".  Lattice currently handles POSIXct date-times, and 
it would be nice if it handled Date too.