[R] Plotting multiple time series with variables having different units
Paul Gilbert
pgilbert902 at gmail.com
Wed Feb 5 19:35:36 CET 2014
I'm not sure if I understand exactly what you mean, but if you want
separate panels, one above the other, with a common time span but each
with their own Y scale, then the function tfplot() in package tfplot
does this. There are examples in the User Guide at
http://cran.at.r-project.org/web/packages/tfplot/vignettes/Guide.pdf. Of
course, if you want fine control over the plot then you are better off
with one of the graphics packages, as others have suggested. Those would
give you complete access to the underlying details. The objective of
tfplot() is to quickly give you something that is fairly good.
I work mostly with economic data, where the different scales is
important, but I rarely work with daily data so your mileage may vary.
Please let me know if you discover problems.
(Sorry to come to this discussion a bit late, but I did not want to
point you to a version I was about to replace. A new version (2014.2-1)
is now on CRAN and will be on the mirrors shortly.)
Paul
On 02/03/2014 06:00 AM, r-help-request at r-project.org wrote:
> Date: Sun, 02 Feb 2014 14:09:38 -0500
> From: David Parkhurst<parkhurs at imap.iu.edu>
> To:r-help at r-project.org
> Subject: [R] Plotting multiple time series with variables having
> different units
> Message-ID:<52EE97F2.3000003 at imap.iu.edu>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> I've tried to figure out how to do this from what I read, but haven't
> been successful. Suppose I have a dataframe with variables Date, X, and
> Y (and maybe U, V, and Z) where X, Y, etc. have different units. I'd
> like to plot Y vs. Time above X vs. Time, above one another.
>
> For example, X is the number of gulls counted on a reservoir, and Y is
> the number of coliform bacteria counted on a petri plate from a water
> sample leaving the reservoir, so these have very different ranges. U and
> V might be numbers of geese and numbers of ducks counted on the same days.
>
> What commands would I use to create such a set of plots?
> Thank you for any help.
> David
>
More information about the R-help
mailing list