Plot function: hourly data and x-axis

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Plot function: hourly data and x-axis

Edoardo Silvestri
Hi all,
I have a little problem with plot function..
I have an hourly dataset and I would like plot a variable with x-axis based
on daily or monthly frequency, just to have a better visualization and
avoid on x-axis all hours of the dataset.

Do you know what is the solution?
Thanks
Edo

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Plot function: hourly data and x-axis

R help mailing list-2
Normally, one turns off the x-axis tick marks and labels by supplying   xaxt='n'  in the plot() call, and then adds a customized x-axis using the axis() function.

But without more information, little help can be provided (a vague question receives a vague answer).

I'd suggest reviewing the posting guide and other advice shown at the bottom of every email sent by R-help.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
 

´╗┐On 8/9/18, 7:51 AM, "R-help on behalf of Edoardo Silvestri" <[hidden email] on behalf of [hidden email]> wrote:

    Hi all,
    I have a little problem with plot function..
    I have an hourly dataset and I would like plot a variable with x-axis based
    on daily or monthly frequency, just to have a better visualization and
    avoid on x-axis all hours of the dataset.
   
    Do you know what is the solution?
    Thanks
    Edo
   
    [[alternative HTML version deleted]]
   
    ______________________________________________
    [hidden email] mailing list -- To UNSUBSCRIBE and more, see
    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.
   

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Plot function: hourly data and x-axis

Jeff Newmiller
In reply to this post by Edoardo Silvestri
Pre-process your data into per-day or per-month records, then plot it. There are many ways to do this... for example, base R has the aggregate function, and the dplyr package has the group_by/summarise functions, and the data.table package can do this as well (read the vignettes).

All of these techniques require that you learn how to deal with timestamps using one or more of the time classes. The most common of these can be introduced by reading

?DateTimeClasses

and/or reading some of the fine blogs online regarding this topic. Note that the trunc.POSIXt function offers one way to identify which time interval each record of your data belongs to.

If you need more assistance, read the Posting Guide and create a reproducible example similar to the data you are working with, and be sure to post it using plain text so it does not get corrupted in the mailing list.

On August 9, 2018 7:51:19 AM PDT, Edoardo Silvestri <[hidden email]> wrote:

>Hi all,
>I have a little problem with plot function..
>I have an hourly dataset and I would like plot a variable with x-axis
>based
>on daily or monthly frequency, just to have a better visualization and
>avoid on x-axis all hours of the dataset.
>
>Do you know what is the solution?
>Thanks
>Edo
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>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.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.