具有不同x值的hist 2变量

时间:2019-02-20 17:38:04

标签: r graph histogram

我有一个数据框“ TOT”,其中有一个物种的丰度值和一个温度值,像这样:

AB_specie    : int  2 1 11 1 6 2 1 8 1 3 

TEMP          : num  24.8 21 24.8 25.6 24.8 ..


structure(list(AB_specie = c(2L, 1L, 11L, 1L, 6L, 2L, 1L, 8L, 1L, 3L, 1L, 1L, 2L, 1L, 65L, 1L, 5L, 2L, 2L, 1L, 2L, 2L, 16L,1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 5L, 1L, 1L, 2L, 1L, 1L, 1L,2L, 2L, 4L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 4L), TEMP = c(24.8332,20.9689, 24.7757, 25.648, 24.7579, 25.2056, 25.6153,23.1105,25.0967, 25.0202, 23.4963, 24.9033, 25.0009, 25.1767, 24.6222,26.5870991, 24.9885006,26.8768997, 25.2455006, 25.8085995, 26.8239002,26.6907997, 27.2084007, 27.2700005, 27.1746998, 27.2026005, 25.3586006,25.4300003, 24.9193001, 27.0338001, 23.0319004, 26.4820995, 25.2614994,27.2424, 27.664, 27.4767, 27.4602, 26.3897, 24.5804, 26.9536,26.3928, 26.1778, 27.1487, 26.3726, 26.6156, 26.5343, 23.7879,24.6767, 26.834, 26.9746)), class = "data.frame")

我想记录温度的频率,并查看物种丰富度的频率如何重叠。要了解在什么温度下我物种的丰富程度

我这样做了:

hist(TOT$AB_specie, breaks=30, xlim=c(0,15), col=rgb(1,0,0,0.5), xlab="", 
 ylab="FREQUENCY", main="" )
hist(TOT$TEMP, breaks=30, xlim=c(0,15), col=rgb(0,0,1,0.5), add=T)
legend("topright", legend=c("AB_specie","TEMP"), col=c(rgb(1,0,0,0.5), 
                                                  rgb(0,0,1,0.5)), pt.cex=2, pch=15 )

但是很明显,有两个不同的x值,我得到这样的东西 enter image description here

您能帮助我了解如何绘制此信息吗?打扰一下,我是初学者

这就是我对散点图的了解: enter image description here

enter image description here

0 个答案:

没有答案