I want to put black boxes around the alpha values in the legend, so the smallest value (70) actually shows up. To be clear: around each individual square representing each alpha value, not around the whole legend.
mtcars
test_plot <- ggplot() +
geom_point(data = mtcars,
aes(x = wt, y = mpg,
alpha = disp,
size = hp),
fill = 'black',
shape = 21) +
geom_point(data = mtcars,
aes(x = cyl, y = mpg,
size = hp),
fill = 'black',
shape = 1) +
xlab("Weight") + ylab("MPG") +
labs(size = "Horsepower:", alpha = "Displacement:") +
scale_size_continuous(range = c(1,10), breaks= c(50, 100, 150, 200, 250, 300, 350)) +
scale_alpha_continuous(range = c(0,1),
breaks= c(71.1, 100, 200, 300, 400, 500),
labels = c(70, 100, 200, 300, 400, 500)) +
guides(size = guide_legend(override.aes = list(shape = 1)),
alpha = guide_legend(override.aes = list(shape = 22, color = 'black')))
test_plot