# NOT RUN {
library(ggplot2)
histPlot <- qplot(
x = Sepal.Length,
data = iris,
fill = Species,
geom = "histogram",
binwidth = 1/4
)
(right <- histPlot)
(bottom <- histPlot + theme(legend.position = "bottom"))
(top <- histPlot + theme(legend.position = "top"))
(left <- histPlot + theme(legend.position = "left"))
grab_legend(right)
grab_legend(bottom)
grab_legend(top)
grab_legend(left)
# }
Run the code above in your browser using DataLab