简体   繁体   English

重新排列条形图 x 轴

[英]Re-arrange stripchart x-axis

This is my graph code, it's supposed to be high, medium, low but at the moment its high, low medium.这是我的图形代码,它应该是高、中、低,但目前它是高、中、低。 Is there anything I can add to this to make it this way?有什么我可以添加到这个的吗?

stripchart(data$Rel.abun.Chaemae ~ data$Shore.Position, 
           vertical = TRUE, 
           method = "jitter", 
           pch  = 21, 
           xlab = "Location",
           ylab = "Relative abundance (Chaemaesipho columna)", 
           ylim = c(0,1))

Ensure that Shore.Position is a factor.确保 Shore.Position 是一个因素。 If not, set it as factor.如果不是,则将其设置为因子。

str(data$Shore.Position)
data$Shore.Position <- factor(data$Shore.Position)

Then, change the order of levels as below and plot.然后,更改级别的顺序如下和 plot。

data$Shore.Position <- factor(data$Shore.Position, levels = c("high", "medium", "low"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM