我正在嘗試caption在每個方面添加一個(我正在使用facet_grid)。我已經看到了這些
有可能有這樣的東西嗎?(情節外的標題)(但沒有先前的警告)
a labs(caption = c("nonchilled=4", "chilled=6")) theme(plot.caption = element_text(hjust=c(0, 1)))

注意:這只是一個例子,但我可能需要為每個情節添加長標題(句子)。例子:
a labs(caption = c("This is my first caption that maybe it will be large. Color red, n= 123", "This is my second caption that maybe it will be large. Color blue, n= 22"))
theme(plot.caption = element_text(hjust=c(1, 0)))
有誰知道該怎么做?
提前致謝
uj5u.com熱心網友回復:
您需要將相同的分面變數添加到主資料框中的附加標題資料框中,以指定應放置每個分面的分面。如果您想要一些未標記的方面,只需使用一個空字串。
caption_df <- data.frame(
cyl = c(4, 6, 8, 10),
conc = c(0, 1000, 0, 1000),
Freq = -1,
txt = c("1st=4", "2nd=6", '', ''),
Type = rep(c('Quebec', 'Mississippi'), each = 2),
Treatment = rep(c('chilled', 'nonchilled'), 2)
)
a coord_cartesian(clip="off", ylim=c(0, 3), xlim = c(0, 1000))
geom_text(data = caption_df, aes(y = Freq, label = txt))
theme(plot.margin = margin(b=25))

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/450640.html
