下面是我的文件格式
Gene Position Depth
DDX11L1 13141 7
WASH7P 15563 324.5768037
FAM138F 35345 5000
OR4F5 69549 800
OR4F29 368127 90
下面是代码
library(ggplot2)
library(plotly)
library(dplyr)
setwd("F:\\Work\\Laptop2_M3_210")
ps = read.table("PositionGE.txt", header=TRUE)
ps$Gene <- as.character(ps$Gene)
ps$Gene <- factor(ps$Gene, levels=unique(ps$Gene))
ggplot(ps) + scale_y_log10() + geom_point(aes(x=Position, y=Depth), color = ifelse(ps$Position<=1000,"black","red")) + geom_bar(aes(x=Position, y=Depth), stat = "identity", width = 0.08, color = "blue") + theme(axis.text.x = element_text(face="bold", color="#993333", size=6, angle=45)) + ylab("Expression Log10 Ratio of GOU_6H_0hr")
我想知道如何进行条件着色
悬停在( <1000 Black, >1000 and <50000 then green, else blue)
(第一列)上时,条形图的to display the Gene, Position and Depth