I was trying to make the legend appear at the bottom of a figure, but cowplot seems to interfere with theme() in ggplot2 so the legend locates at the bottom-left corner (instead of the bottom-middle.
Here is a minimum example:
library(ggplot2)
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
head(ToothGrowth)
p <- ggplot(ToothGrowth, aes(x=dose, y=len, fill=dose)) +
geom_boxplot()
p + theme(legend.position="bottom")
library(cowplot)
p + theme(legend.position="bottom")
I am using version 0.9.3 under R (ver. 3.5.0) and macOS Majove (ver. 10.14).
I was trying to make the legend appear at the bottom of a figure, but cowplot seems to interfere with
theme()
in ggplot2 so the legend locates at the bottom-left corner (instead of the bottom-middle.Here is a minimum example:
I am using version 0.9.3 under R (ver. 3.5.0) and macOS Majove (ver. 10.14).