0

How might I go about having the following two plots layered on top of one another on the same plot?

Furthermore, I would like to have the y-axes units for the first plot on the left hand side of the plot and the y-axes units for the second plot on the right hand side. I would also like to have the x-axes placed on the top and bottom of the plot respectively.

ggplot(data=diamonds, aes(price)) + geom_density()

ggplot(diamonds, aes(y=price, x = clarity)) + geom_bar(stat="identity")
skleene
  • 389
  • 3
  • 13
  • 2
    They don't even share the x-axis. How is that going to make any sense? – cbeleites unhappy with SX Apr 06 '13 at 12:54
  • 3
    **ggplot2** was created with some specific design decisions that make plots like these (multiple x/y axes) very difficult, or even impossible, because multiple axes are generally considered a Very Bad Thing. You will probably find it easier to do this in base graphics. – joran Apr 06 '13 at 14:00
  • @joran Thank you, that does make sense. I'll take that into consideration. – skleene Apr 06 '13 at 16:15

0 Answers0