Order of x-axis labels in the scatter plots

Thanks for a good tool.
I have four factors in a predictive variable; Q1, Q2, Q3, and Q4.
I’ve set Q1 as a reference.
However, I found that the order of the x-axis labels was Q1, Q3, Q2, and Q4 in scatter plots.
I tried to change the labels of the variable with A, B, C, and D, but the trouble was the same such as A, C, B, and D orders.
I think this problem happened after updating with a new version of Maaslin2 including the reference option.
Could you check this problem?
The version of Maaslin2 I used is 1.8.0 in R.

I also faced the same problem. Really happy if any can help,

Thank you.

Hi @Han-Na_Kim,

I’m not sure what is happening here, MaAsLin should default to base R for things like order, and R would have ordered these 1. by increasing order and 2. alphabetically. I don’t think this is a MaAsLin issue per say, can you check your metadata object by running the str() command? Is there some inherent ordering on that level?

If nothing else you can always force an order meta$cat = factor(meta$cat, levels = c("A", "B", "C", "D")). The current version of MaAsLin may ignore this attempt. In which case, you can always pull out the data and use ggplot to plot the data. We are working on outputting the ggplot objects for a future version of MaAsLin but in the meantime it is pretty easy to do that outside of the library.

I hope this helps,
Kelsey

Thanks for your reply.
I’ve already tried to force the order such as factor(data$variable, levels=c(“Q1”,“Q2”,“Q3”,“Q4”)), but same problem is happenned.
When I run the str(variable), it showed $variable: Factor w/4 levels “Q1”,“Q2”,“Q3”,…:1 1 1 1 1 1 …