gmteunisse / fantaxtic

Fantaxtic - Nested Bar Plots for Phyloseq Data
26 stars 3 forks source link

Repeated sampling, paired bars #1

Closed st01565 closed 5 years ago

st01565 commented 6 years ago

Hi, It might be that this is the wrong forum for this question, and if so, I apologize.

I have a dataset with 800 samples from 62 participants. All participants were sampled 2 times, and 11 have been sampled three times with 6 different sample types.

I'd like to generate a bar plot that compares the relative abundances for these individuals (by sample type) at two (three) different time points (ie 6 charts, rel abundance at the y-axis, at the x-axis individual samples grouped by participant (2-3 bars per participant).

Would that be possible using your package? Grateful for any help!

Rune Nielsen, Bergen, Norway

gmteunisse commented 6 years ago

Dear Rune,

Sorry for the late response, I wasn't notified of the opened issue. I hope I can still be of help.

This is definitely possible, using the facet_by and grid_by arguments of the fantaxtic_bar function, for example fantaxtic_bar(physeq_obj = physeq_obj, color_by = "Phylum", label_by = "Genus", facet_by = "individual", grid_by = "sample_type").

Alternatively, you could drop the grid_by argument and only use facet_by = "sample_type" and use order_alg = "as.is". This assumes that the samples in the phyloseq object are ordered by individual.

I realize that there's a simple group = ... option missing such as is available in ggplot2. I will see whether I can implement that in due time.

Hope this has been of help! Let me know if you have any questions.