knitr::opts_knit$set(upload.fun = identity)
library(ggplot2)
ggplot(mpg, aes(displ, hwy, colour = cty, size = year)) +
geom_point(aes(alpha = cyl)) +
guides(
colour = guide_colourbar(
position = "inside",
legend.position.inside = c(0.2, 0.2)
),
size = guide_legend(
position = "inside",
legend.position.inside = c(1, 1)
)
)

Created on 2024-09-17 with reprex v2.1.0
~