我正在努力更改 ggpplot2 中的圖例標題。該情節的圖例標題為“Enrichment_Score”,我想更改為“Enrichment Score”。
如果有人可以提出建議,那就太好了。
D1 <- ggplot(Practice, aes(Practice$case, Practice$pathway,
colour = Enrichment_score, size = Practice$q.value))
geom_point()
scale_colour_gradientn(colours = cols)
theme(legend.position="bottom")
scale_size(range = c(1,15))
guides(size=guide_legend(title = "FDR q value"),
scale_color_gradient=guide_legend("Enrichment Score"))
D1 ggtitle("Gene Set Enrichment Treg cells")
xlab("Case") ylab("Hallmark Gene Sets")
theme_bw() ```
Treg細胞
uj5u.com熱心網友回復:
例如,您可以通過 ggplot2 函式重命名圖例中的美學,labs如下面的 reprex 所示。
library(ggplot2)
df <- data.frame(
x = runif(100),
y = runif(100),
z1 = rnorm(100),
z2 = abs(rnorm(100))
)
ggplot(df, aes(x, y))
geom_point(aes(colour = z1))
scale_colour_gradient2()
labs(colour = "My Legend Name")
再現輸出
由reprex 包(v2.0.1)于 2021 年 10 月 13 日創建
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/315824.html
