Description Usage Arguments Value References Examples
lot dual y-axis for ggplot2 objects.
1 | ggdual_axis(lhs, rhs, angle = 270)
|
lhs |
A plot whose y axis shall be on the left hand side. |
rhs |
A plot whose y axis shall be on the right hand side. |
angle |
Angle to rotate y-axis on right hand side. |
Returns an arrangeGrob
with extra class
ggdual_axis
that plots by default. This allows it to be further
combined with other grobs via grid.arrange
.
http://stackoverflow.com/a/27608585/1000343 http://stackoverflow.com/a/25699817/1000343
1 2 3 4 5 6 7 8 9 10 11 | p1 <- ggplot(mtcars, aes(mpg, disp)) +
geom_line(colour = "blue") +
theme_bw() +
theme(plot.margin = grid::unit(c(.5, 1, .5, 0), "cm"))
p2 <- ggplot(mtcars, aes(mpg, drat)) +
geom_line(colour = "red") +
theme_bw() +
theme(plot.margin = grid::unit(c(.5, 1, .5, 0), "cm"))
ggdual_axis(lhs = p1, rhs = p2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.