我想把注释" a)"在左边有我的情节的y轴的一侧。我已经读过我应该使用" custom_annotation",但我最接近的是如下:
#create dataframe for an example plot
df <- data.frame(matrix(c(1:3, 6:8, 11:13), nrow = 1))
names(df) <- paste0(rep(LETTERS[1:3], each = 3), 1:3)
sdf <- stack(df)
sdf <- transform(sdf, group = substring(ind, 1, 1),
obs = substring(ind, 2))
#example plot
require(ggplot2)
plt <- ggplot(sdf, aes(x = group, y = values)) +
geom_boxplot()+
annotation_custom(
grob = textGrob(label = "a)", hjust = 0, gp = gpar(cex = 1.5)),
ymin = 12.5,
ymax = 12.5,
xmin = 0.2,
xmax = 1)
plt
当我尝试将x min / x max更改为负数(即-0.2)时,我的注释会消失而不是移动到y轴的左侧。任何帮助将不胜感激!