library(ggplot2)
# Plot with multiple legends
p <- ggplot(mtcars, aes(mpg, wt, color = factor(cyl), size = hp)) +
geom_point()
# Default order
p
# Size legend first, then colour
p + legend_order_guides(size = 1, colour = 2)
# Colour legend first
p + legend_order_guides(colour = 1, size = 2)
Run the code above in your browser using DataLab