Skip to content

Crazy plots of time-series against dates

4 messages · Marco Taboga, Peter Dalgaard

#
I did what you suggested, but nothing changed. I noticed that, if I display
the plot without first loading the chron library, the plot is OK, but the
dates on the time axis are replaced by sequential numbers.
I send you an attachment with the zipped plot, so you can see it.
Thank you.
Marco Taboga (mtaboga at tiscalinet.it)


----- Original Message -----
From: "Thomas Lumley" <tlumley at u.washington.edu>
To: "Marco Taboga" <mtaboga at tiscalinet.it>
Cc: <r-help at hypatia.math.ethz.ch>
Sent: Monday, April 30, 2001 6:58 PM
Subject: Re: [R] Crazy plots of time-series against dates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot.zip
Type: application/x-zip-compressed
Size: 27462 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20010501/1bba08ef/plot.bin
#
"Marco Taboga" <mtaboga at tiscalinet.it> writes:
Interesting effect... 

I don't know what the real cause is, but evidently it is the axis
labels that are off (looking like what you get from applying deparse
to a vector/chron object), so a quick fix would be to set xlab and
ylab to sensible text strings. I.e.

plot(a, b, type='l', xlab="a", ylab="b)

Do you think you could cook up a small example (e.g. using simulated
data) exhibiting the same behaviour?
#
OK, it works.  xlab and ylab had to be set properly.
If you want to see what actually goes on, try:
a<-chron(1:2000)
b<-1:2000
plot(a,b,type="l")

Marco Taboga (mtaboga at tiscalinet.it)


----- Original Message -----
From: "Peter Dalgaard BSA" <p.dalgaard at biostat.ku.dk>
To: "Marco Taboga" <mtaboga at tiscalinet.it>
Cc: "Thomas Lumley" <tlumley at u.washington.edu>; <r-help at stat.math.ethz.ch>
Sent: Tuesday, May 01, 2001 7:43 PM
Subject: Re: [R] Crazy plots of time-series against dates
display
the
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"Marco Taboga" <mtaboga at tiscalinet.it> writes:
One of the standard blunders with R's lazy evaluation and substitute is
to change the value of part of a substitute expression before it is
evaluated. I think the chron maintainer even inserted a note in the
FAQ about that (Hi, Kurt ;) )

In plot.times insert the line below to fix it

    if (!is.null(type <- dots$type)) 
        if (any(type == c("l", "b", "o"))) {
            xlab ; ylab  # force promises
            nas <- is.na(x)
            ...

Cc'ed to R-bugs so that it gets filed and eventually fixed.