放大/调整RDA图上的样式

问题描述 投票:1回答:1

我是R的新手,我正在制作一个RDA图表,其中包含通过veganadespatial软件包获得的一些数据的绘图,生成我的图表如下

生成图形

enter image description here

图形是正确的,但从美学上讲不是很好,因为很难解释名称(因为您甚至无法欣赏名称),所以我想要的是能够以某种方式修改比例以使数据看起来更加分散从而欣赏数据。

我希望我的图形看起来像这样,您至少可以看到名称的缩写

示例图表

enter image description here

我用来生成图形的代码如下

windows(width = 12, height = 10)

par(mar=c(3,3,1,1), mgp=c(2,1,0), cex=0.8, maii=c(0.1,0.1,0.2,0.1))

plot(str.rda, xlab="RDA1 (32.16 %)", ylab="RDA2 (14.46 %)", display=c("cn", "lc", "sp"), type="n", xlim=c(-0.8,0.8),correlation=TRUE)

sites.sc <- scores(str.rda, choices=1:2, scaling=2, display="lc")
points(sites.sc, pch=1, cex=0.5)
text(sites.sc,row.names(sites.sc), cex = 0.6, pos = 4, col = "chocolate1")

va.sc <- scores(str.rda, choices=1:2, scaling=2, display="sp")
sp.names<- c("Americabaetis", "Baetodes", "Camelobaetidius", "Cloeodes", "Nanomis","Varipes","Zelusia","Caenis", "Trichorythodes",  "Lumahyphes","Farrodes","Thraulodes", "Anacroneuria", "Protoptila","Helicopsyche", "Leptonema", "Smicridea", "Alisotrichia", "Celaenotrichia", "Cerasmatrichia", "Hydroptila", "Metrichia", "Neotrichia", "Orthotrichia", "Oxyethira", "Rhyacopsyche", "Chimarra")
text(va.sc[c(1,2,3,4,5,6,7,8,9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,22, 23, 24, 25, 26, 27 ),], sp.names[c(1,2,3,4,5,6,7,8,9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,22, 23, 24, 25, 26, 27 )], cex=0.8, font=3, pos=3,offset=0.1)

env.sc <- scores(str.rda, choices=1:2, scaling=2, display="bp")
arrows(0,0, env.sc[1:3,1], env.sc[1:3,2], lty=1, lwd=1, col="Blue", length=0.1)

env.names <- c("DQO", "DBO", "Turbidez")
text(env.sc[c(1,2,3),], env.names[c(1,2,3)], cex=0.9, font=2, pos=2,offset = 0.1)

我正在阅读,发现了几种替代方法,例如修改xlim(最低值,最高值)和ylim(最低值,最高值),但是图形以相同的方式出现,所以我不这样做不知道该如何做才能在美学上进行改进,感谢您的关注和帮助。

r plot
1个回答
0
投票

您应该注意的一件事是,使用plot(str.rda)实际上会调用不表现为vegan:::plot.cca()plot.default()。为了避免这种情况,您可以简单地使用带有两个点的空图:

plot(c(-1, 1), c(-.8, .8), xlab="RDA1 (32.16 %)", ylab="RDA2 (14.46 %)", type="n")
abline(h = 0, v = 0, lty = 2, lwd =.5) # add x=0 and y=0 guide lines
# then you can add the rest of your code

请注意,xlimylim将按照您期望的方式运行。希望这可以帮助。

© www.soinside.com 2019 - 2024. All rights reserved.