[R] plot 2 y axis
jim at bitwrit.com.au
Wed Apr 17 00:46:31 CEST 2013
On 04/17/2013 08:35 AM, Ye Lin wrote:
> I want to plot two variables on the same graph but with two y axis just
> like what you can do in Excel. I searched online that seems like you can
> not achieve that in ggplot. So is there anyway I can do it in a nice way in
> basic plot?
> Suppose my data looks like this:
> Weight Height Date
> 0.1 0.3 1
> 0.2 0.4 2
> 0.3 0.8 3
> 0.6 1 4
> I want to have"Date"as X axis ,"Weight" as the left y axis and "Height" as
> the right y axis.
Hi Ye lin,
Try this (yldat is your data above as a data frame):
That should get you started.
More information about the R-help