我已经使用openair和hexbin包在散点图函数命令的帮助下创建了两个散点图:
scatterPlot(mydata, x ="Observed" , y = "Model1",xlab=10, ylab=10,method = "hexbin",mod.line=T,auto.text=F, col = "jet", xbin = 30)
scatterPlot(mydata, x ="Observed" , y = "Model2",xlab=10, ylab=10,method = "hexbin",mod.line=T,auto.text=F, col = "jet", xbin = 30)我已经得到了散点图,但是如果我想把它们放到一个图中,用一种颜色计数来得到类似这样的东西:我应该如何继续?
please refer to this link to view the image : https://ibb.co/rF148kp
发布于 2019-02-04 19:08:15
您可以重新组织数据框,使其具有三列-“已观察”、“已建模”和“模型类型”。示例:
structure(list(observed = c(2L, 2L, 4L, 4L, 6L, 6L, 8L, 8L, 10L,
10L, 12L, 12L, 14L, 14L, 16L, 16L, 18L, 18L, 20L, 20L), modelled = c(1L,
5L, 7L, 2L, 5L, 9L, 13L, 15L, 16L, 14L, 18L, 17L, 10L, 21L, 26L,
24L, 22L, 28L, 27L, 30L), model_type = structure(c(1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L), .Label = c("Model 1", "Model 2"), class = "factor")), class = "data.frame",
row.names = c(NA,
-20L))这样,您就可以使用以下代码-
scatterPlot(mydata, x = "observed", y = "modelled", type = c("model_type"),
method = "hexbin",mod.line=T,auto.text=F, col = "jet", xbin = 5,
linear = TRUE, layout = c(2, 1))创建包含两个散点图的图。注意,上面的代码将xbin设置为5纯粹是因为我使用了一个很小的数据集进行测试。另外,请原谅y轴和代码中的拼写错误(“modeled”应该是"modeled")!

https://stackoverflow.com/questions/54503565
复制相似问题