I am trying to plot the data below such that the legend shows the red and black + markers along with the bubble scale.
Any help would be much appreciated.
df <- data.frame(x=seq(1,10), y=seq(1,10), z=c(1,0,5,3,1,8,0,12,1,0))
p <- ggplot() +
geom_point(data = df %>% filter(z==0),
aes(x=x, y=y),
shape=3,
size=5,
colour="red",
alpha=0.75,
show.legend=T) +
geom_point(data = df %>% filter(z>0 & z<=1),
aes(x=x, y=y),
shape=3,
size=5,
colour="black",
alpha=0.75,
show.legend=T) +
geom_point(data = df %>% filter(z>1),
aes(x=x, y=y, size=z),
colour="red",
alpha=0.75,
show.legend=T)
Benoit Casault