[R] how to put barchart and line chart in the same plot in ggplot2

Jim Lemon jim at bitwrit.com.au
Sun Aug 5 09:55:05 CEST 2012


On 08/05/2012 10:17 AM, xin wei wrote:
> dear userR:
> I am trying to plot two dependent variables in the same plot in ggplot2.
> because these two variables have very different magnitude, I have to use a
> second Y axis. I hope one variable to be line and the other to be barchart.
> The x axis is continuous. Yet since I have to make barchart, I guess I have
> to treat it as discrete or categorical.
> I have been google searching for the whole afternoon but do not have any
> clue.
> Can anyone give me a direction (not have to be a complete answer...)?
>
Hi xin wei,
If you're desperate, have a look at twoord.plot in the plotrix package.

Jim



More information about the R-help mailing list