Re-arrange stripchart x-axis

1k Views Asked by At

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))
1

There are 1 best solutions below

0
On BEST ANSWER

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"))