I have some data:
df <- data.frame(grade=c('C','F','D','B','A','C','A','A','C','F','B','B','C','A','B'),test=c(800,700,750,220,550,650,675,350,350,460,780,540,675,490,370),
condition=c('Condition 2','Condition 2','Condition 1','Condition 1','Condition 1','Condition 2','Condition 1','Condition 2','Condition 2','Condition 2','Condition 1','Condition 2','Condition1','Condition 2','Condition 2'),
count=c(10,11,12,15,12,13,15,13,19,18,15,20,20,22,23))
and I'm trying to make the legends be at the bottom and in the center
example <- ggplot(df, aes(x = grade, y = test, size = count, fill = condition)) +
geom_point(shape=21) +
theme(legend.position = "bottom") +
guides(fill = guide_legend(order=1), size = guide_legend(order=2))
I would love it if the legend looked like this: Condition [condition legend] Count [count legend]
I tried this and I placed the nrow in the wrong place
example <- ggplot(df, aes(x = grade, y = test, size = count, fill = condition)) +
geom_point(shape=21) +
theme(legend.position = "bottom", nrow=4) +
guides(fill = guide_legend(order=1), size = guide_legend(order=2))
I found instructions here and nothing changed (search for "p2 + theme(legend.position = "bottom")"
example <- ggplot(df, aes(x = grade, y = test, size = count, fill = condition)) +
geom_point(shape=21) +
theme(legend.position = "bottom") +
guides(fill = guide_legend(order=1), size = guide_legend(order=2)) + theme(legend.title.align=0.5)+
theme(legend.justification = "bottom")
Can anyone assist?