我正在尝试绘制RNA序列中数据集的火山图。我想添加一个自定义图例,其中包含下调,上调和不下调的值,但我真的不知道该怎么做,也找不到在Google中做到这一点的方法(也许是我的问题这是我对R的经验不足。
这是我到目前为止的情节代码:
ggplot(df_toxins, aes(x = logFC, y = -log10(FDR))) +
geom_point(data = subset(df_toxins, logFC > -1 & logFC < 1),
color = "black", alpha = 0.6, size = 1.5) +
geom_point(data = subset(df_toxins, logFC < -1),
color = "red", alpha = 0.5, size = 2.5) +
geom_point(data = subset(df_toxins, logFC > 1),
color = "blue", alpha = 0.5, size = 2.5) +
geom_vline(xintercept = c(-1, 1), linetype = "dashed") +
geom_hline(yintercept = 0) +
theme_linedraw() +
theme(plot.title = element_text(hjust = 0.5, size = 22)) +
ggtitle("Toxins")