我有一个像这样的文件
>distance A B
>-100000 0 0
-99975 8.99341232547159e-07 8.99341232547159e-07
-99950 1.79868246509432e-06 1.79868246509432e-06
........
.......
99950 2.69802369764148e-06 0
99975 0 8.99341232547159e-07
100000 0 4.4967061627358e-06
我想创建一个直方图(在R或excel中),距离为x坐标 并且值为A和B
例如this
之类的内容
任何帮助都会很棒!
编辑(添加可重现的数据)
dat <- data.frame(distance <- seq(-100000 ,100000 ,100000-99975 ),
A=rnorm(length(distance)),
B=rnorm(length(distance)))
答案 0 :(得分:0)
试试这个示例代码:
dat <- data.frame(distance <- seq(-1500 ,1500 ,25),
A=rnorm(length(distance),mean=0,sd=0.1),
B=rnorm(length(distance),mean=0,sd=0.09))
plot(dat[,c(1,2)],type="l",
col="blue",
main="My Title",
xlab="My X Label",
ylab="My Y Label",
axes=F)
lines(dat[,c(1,3)],type="l",col="red")
axis(1, pos=0,las=1)
axis(2, pos=0,las=1)
legend("topright", pch = c("-","-"),
col = c("blue", "red"),
legend = c("A", "B"))