[R] a little (more) help needed plotting chron object

Gabor Grothendieck ggrothendieck at gmail.com
Tue Nov 21 06:10:59 CET 2006


I played with it a bit more and the problem is that if the times span
24 hours or more then days are used and otherwise not.  For example,
compare:

s1 <- seq(0, 1, 1/12)
plot(times(s1), s1)

# and
s0 <- seq(0, .9999, 1/12)
plot(times(s0), s0)

packageDescription("chron")$Version # "2.3-9"

On 11/20/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> I can't reproduce that.  When I use that s I do get 13 ticks as shown
> below.  What version of chron and R are you using?
>
> > plot(tv, yjunk, pch = yjl, xaxt = "n")
> > s <- seq(0, 1, 1/12)
> > out <- axis(1, s, substr(chron(s), 11, 15))
> > out
>  [1] 0.00000000 0.08333333 0.16666667 0.25000000 0.33333333 0.41666667
>  [7] 0.50000000 0.58333333 0.66666667 0.75000000 0.83333333 0.91666667
> [13] 1.00000000
> >
> > R.version.string # XP
> [1] "R version 2.4.0 Patched (2006-10-24 r39722)"
> >
> > packageDescription("chron")$Version
> [1] "2.3-9"
>
> On 11/20/06, Randy Zelick <zelickr at pdx.edu> wrote:
> > Hello Gabor,
> >
> > Thanks very much for your help. The solution you offered:
> >
> > >
> > > plot(tv, yjunk, pch = yjl, xaxt = "n")
> > > s <- seq(0, 1, .2)
> > > axis(1, s, substr(chron(s), 11, 15))
> > >
> >
> > does provide time labels, but I can't seem to get a time less than 8:00.
> > For example, if I try
> >
> > s <- seq(0,1,(1/12)) and run chron on it, I get this OK result:
> >
> > [1] (01/01/70 00:00:00) (01/01/70 04:00:00) (01/01/70 08:00:00)
> > [4] (01/01/70 12:00:00) (01/01/70 16:00:00) (01/01/70 20:00:00)
> > [7] (01/02/70 00:00:00)
> >
> > I expected eight tics labeled 00:00, 04:00, etc. The axis command insists,
> > however, in starting the xaxis no earlier than 8:00. Various adjustments
> > of the range parameters do not seem to help.
> >
> > Perhaps 'axis' has a notion about spacing labels and I am fighting that,
> > but then it was told via "s" where to put the tics!
> >
> > Thanks, again, in advance,
> >
> > =Randy=
> >
> > R. Zelick                               email: zelickr at pdx.edu
> > Department of Biology                   voice: 503-725-3086
> > Portland State University               fax:   503-725-3888
> >
> > mailing:
> > P.O. Box 751
> > Portland, OR 97207
> >
> > shipping:
> > 1719 SW 10th Ave, Room 246
> > Portland, OR 97201
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>



More information about the R-help mailing list