Open Hina1112 opened 1 year ago
I am making graph in R studio.
OTU table***
I am making a graph plot from out 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
Not sure if this is related to a specific bug you're experiencing or just want some advice. If it's a bug, can you provide the code you are using to create the plot? It will help identify the functionality issue.
If it's just advice, are you using a specific factor to group by? It might be grouping them together on some other basis if a factor has not been set or selected.
Factor info here: https://github.com/joey711/phyloseq/issues/209
Plot info here: https://github.com/joey711/phyloseq/issues/1676
Some suggestions to try: 1) You can set and change factors in the phyloseq object if you just want samples grouped together based on a specific factor, e.g treatment group.
A) Check if the factor has already been set levels(sample_data(pc)$column_name)
B) Set the factor in the order needed sample_data(ps)$column_name <- factor( sample_data(ps)$column_name, levels = c( "1st-Factor", "2nd-Factor", ... "last-factor"))
C) Change the factor name if needed
sample_data(ps)$column_name <- factor( sample_data(ps)$column_name,
labels = c( "1-F", "2-F", ... "L-F"))
2) If you want to specify the exact order of samples to output, try the package below to list the specific order of the samples: https://david-barnett.github.io/microViz/reference/ps_reorder.html
hope this helps
I am making a graph plot from out 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