joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
567 stars 187 forks source link

R studio graph plot, samples are not together #1682

Open Hina1112 opened 1 year ago

Hina1112 commented 1 year ago

I am making a graph plot from OTU table, when the result came my samples from same group go far apart from each other. LF1,LF2,LF3 and HF1, HF2, HF3.. I want them to be like LF1,LF2.. hf1, hf2, hf3 but it comes out like HF1, LF2, HF2, LF3, LF2, HF3

samd1993 commented 11 months ago

I think you can treat your factor as an actual R factor. this explains how to reorder factor levels where in this case, phyloseq@sam_data$sampleid would be your factor and your samples would be your levels. if this doesnt work then you will have to extract your plot as a dataframe and then work with it as an R dataframe to reorder them

https://www.statology.org/reorder-factor-levels-in-r/

Hina1112 commented 11 months ago

Thank you so much, i got this.

On Wed, Aug 9, 2023 at 11:51 AM Samuel Degregori @.***> wrote:

I think you can treat your factor as an actual R factor. this explains how to reorder factor levels where in this case, @.***_data$sampleid would be your factor and your samples would be your levels. if this doesnt work then you will have to extract your plot as a dataframe and then work with it as an R dataframe to reorder them

https://www.statology.org/reorder-factor-levels-in-r/

— Reply to this email directly, view it on GitHub https://github.com/joey711/phyloseq/issues/1682#issuecomment-1670576825, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7V27GQEWDBHTEX76CWPSLTXUL3LVANCNFSM6AAAAAAYB5MJW4 . You are receiving this because you authored the thread.Message ID: @.***>