????? Thanks for the reply.
On 2020-01-27 19:56, Abby Spurdle wrote:> Maybe I'm missing something really obvious here, but I was unable to
> create a matrix out of POSIXct object(s).
> Perhaps that deserves a separate discussion...?
????? Can you provide an example?
????? The standard matplot application that concerns me is with
matplot(x, y, ...) where x has class Date or POSIXct and y is a matrix.?
The "fda" package on CRAN includes a "matplot" help page
with examples
that worked when I tested them recently.
????? If you have an example that you think should work but doesn't I'd
like to know.? Maybe it should be added to the examples in
fda::matplot.Rd file, then the code should be modified until it
works.>
> Regarding your other comments/questions:
> (1) You should *NOT* mask functions from the graphics package (or
> base, stats, etc), except possibly for personal use.
> (2) The xlab and ylab are fine.
??? ? In most situations, I agree with your comment that, "You should
*NOT* mask functions from the graphics package (or base, stats, etc)".
????? However, when the behavior of the function in graphics, base, or
stats seems patently inappropriate and not adequately considered, then I
think that someone should mask the function in the core distribution
with one whose behavior seems more consistent with what most users would
most likely want.
????? Ten or twelve years ago, I concluded that the behavior of
graphics::matplot(x, y, ...) was inappropriate when x is either of class
Date or POSIXct.? Specifically, it labeled the horizontal axis the same
as graphics::matplot(as.numeric(x), y, ...).? I think it should instead
be labeled the same as graphics::plot(x, y[,1], ...) in such cases.? To
fix this problem, I made fda::matplot generic; graphics::matplot is not
generic.? And a coded methods for x of class numeric, matrix, Date and
POSIXct plus a default.? Each calls either graphics::matplot or matlines
as appropriate after first setting up the horizontal axis properly if x
is of class Date or POSIXct.
????? For specific examples, consider the following taken from
fda::matplot.Rd:
invasion1 <- as.Date('1775-09-04')
invasion2 <- as.Date('1812-07-12')
earlyUS.Canada <- c(invasion1, invasion2)
Y <- matrix(1:4, 2, 2)
graphics::matplot(earlyUS.Canada, Y)
# horizontal axis labeled per as.numeric(earlyUS.Canada),
# NOT as Dates
fda::matplot(earlyUS.Canada, Y)
# problem fixed.
# POSIXct
AmRev.ct <- as.POSIXct1970(c('1776-07-04', '1789-04-30'))
graphics::matplot(AmRev.ct, Y)
# horizontal axis labeled per as.numeric(AmRev.ct),
# NOT as POSIXct
fda::matplot(AmRev.ct, Y)
# problem fixed.
????? Comments?
????? Thanks again for the reply.
????? Spencer Graves>
> B.