I have a variable containing a measurement of a duration in seconds which I would like to use in a plot, with the axes labelled in a format like %H:%M:%S (or possibly %Hh%Mm) if the duration is more than an hour, or just %M:%S if more than a minute, or just decimal seconds if short enough. Is there a class with an axis.* method defined that has behaviour something like this? Duncan Murdoch
The times class in chron will give hours and minutes. e.g. library(times) plot(times(0:23/23), 0:23) and you could modify chron:::axis.times for the others. On 4/30/06, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:> I have a variable containing a measurement of a duration in seconds > which I would like to use in a plot, with the axes labelled in a format > like %H:%M:%S (or possibly %Hh%Mm) if the duration is more than an hour, > or just %M:%S if more than a minute, or just decimal seconds if short > enough. Is there a class with an axis.* method defined that has > behaviour something like this? > > Duncan Murdoch > > ______________________________________________ > 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 >
That should have been: library(chron) plot(times(0:23/24), 0:23) On 4/30/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:> The times class in chron will give hours and minutes. e.g. > > library(times) > plot(times(0:23/23), 0:23) > > and you could modify chron:::axis.times for the others. > > On 4/30/06, Duncan Murdoch <murdoch at stats.uwo.ca> wrote: > > I have a variable containing a measurement of a duration in seconds > > which I would like to use in a plot, with the axes labelled in a format > > like %H:%M:%S (or possibly %Hh%Mm) if the duration is more than an hour, > > or just %M:%S if more than a minute, or just decimal seconds if short > > enough. Is there a class with an axis.* method defined that has > > behaviour something like this? > > > > Duncan Murdoch > > > > ______________________________________________ > > 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 > > >