简体   繁体   中英

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. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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