答案 0 :(得分:2)
以下是您需要考虑的事项:
geom_col
输入的次数少于geom_bar(stat = ...)
scale_fill_gradient2()
theme_classic
所以你可以尝试这样的事情:
library(tidyverse)
df1 %>%
ggplot(aes(reorder(Tissue, LogFold), LogFold)) +
geom_col(aes(fill = LogFold)) +
scale_fill_gradient2(low = "white",
high = "blue",
midpoint = median(df1$LogFold)) +
coord_flip() +
labs(x = "Tissue")
但我不知道颜色渐变在解释信息方面确实增加了很多东西。所以这是没有它的结果,你就是法官:
df1 %>%
ggplot(aes(reorder(Tissue, LogFold), LogFold)) +
geom_col() +
coord_flip() +
labs(x = "Tissue") +
theme_classic()
答案 1 :(得分:0)
ggplot(data=df1, aes(x=Tissue, y=LogFold, fill = LogFold)) +
geom_bar(stat="identity",color="black")+
scale_fill_gradient(low="white",high="darkred")+
coord_flip()+
ylim(0, 15)+
scale_x_discrete(limits = df1$Tissue)+
theme_classic()