[R] Attempting to plot two different time series together

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Fri Nov 6 02:25:55 CET 2015

Seems like you would benefit from reading about long and wide data... perhaps  [1]. 

If I am understanding what you want,  ggplot facetting should be able to do what you want.  You first have to put the data in long form (e.g. variable, timestamp, value) before you give it to ggplot.

If you want more specific help then you should provide a small sample data set as one or more  R dputs as the Posting Guide recommends (see footer, and  [2]).

[1] https://cran.r-project.org/web/packages/tidyr/vignettes/tidy-data.html

[2] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

On November 5, 2015 7:00:18 AM PST, Ezra Boyd <ezgis76 at gmail.com> wrote:
>I am trying to create a plot (I guess two plots) using two different
>series datasets, but I'm not sure of the best approach.  The data is
>from a
>tidal surge due to a hurricane and I would like to show the
>between stage and windspeed/direction.
>One dataset is the tidal stage and it is sampled in 30 minutes
>The other dataset is windspeed and direction and it is sampled every 6
>minutes.  I would like to display the tidal hydrograph and then also
>windspeed and direction as a banner above it.  They would be two
>plots, but with identical x-axis (as opposed to one plot that has both
>& wind.)
>Should I combine the two time series into one dataframe (with lots of
>so that I can create the plots together, for example using pairs or
>ggpairs? Or should I keep them separate, make the individual plots, and
>then work on the layout in graphic design software? I would prefer the
>former, but I just can't figure out how to make that work out.
>Also, is it possible to depict wind direction (which is given in degree
>clockwise from due north) with an arrow?
>Thank you very much,

More information about the R-help mailing list