我现在的图是这样的:
但我想在情节中添加一两个其他系列的文本,看起来像这样:
使用ggplot做这样的事情甚至是可能的吗?或者我应该去找另一个包吗?
更新:以下是我当前绘图的代码:
ggplot() + geom_col(data = s, aes(x = V1, y = V3, fill = V3), show.legend = F) +
coord_flip() +
labs(x = "", y = "") +
scale_fill_gradient(low = "yellow", high="darkgreen") +
theme(axis.text.y = element_text(vjust = 0, hjust = 0), plot.margin = margin(1, 0.3, 0.1, 0.3, "cm"), panel.background = element_rect(fill = 'white', colour = 'white'), axis.ticks.y = element_blank()) + ylim(0, 6)
这是一些假数据
这是真实的数据的输出结果
structure(list(V1 = c("regulation of locomotion", "regulation of cell migration",
"skin development", "negative regulation of biological process",
"cell adhesion", "response to oxygen-containing compound"), V2 = c(7.74e-05,
0.000143, 0.000165, 0.000176, 0.00019, 0.00019), V3 = c(4.111259039,
3.844663963, 3.782516056, 3.754487332, 3.721246399, 3.721246399
)), row.names = c(NA, 6L), class = "data.frame")
1条答案
按热度按时间g9icjywg1#
如果只有一列,最简单的方法之一就是通过
geom_text
图层为轴文本添加第二列。您只需确保为轴文本设置正确的大小和颜色: