gmteunisse / fantaxtic

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

Customize x-axis #5

Closed aaronejaime closed 2 years ago

aaronejaime commented 2 years ago

Hey! I'm already loving fantaxtic so much!

I was just wondering if there have been an update (or maybe a function that I'm ignoring) where I can customize de x-axis and instead of 'Sample' choose another column in metadata?

Thanks

gmteunisse commented 2 years ago

Hi aaronjaime,

Thanks for your interest. I am no longer actively maintaining this package, so there haven't been any updates. I'll outline some potential solutions that might work for what you want to achieve.

One option is to use the facet_by or grid_by options to split the plot by other columns in the metadata. An alternative is to re-label your Sample names to include your column of interest (e.g. "level_A_sample_1", "level_A_sample_2", "level_B_sample_1"). Furthermore, you could order your x-axis factor levels manually and specify fantaxtic_bar(ps_obj, ... , order_alg = "as.is"), that way the plot should come out by your custom ordering. Something else you could try is to simply add a new x-axis scale, e.g. fantaxtic_bar(ps_tmp, ... ) + scale_x_discrete(labels = c("new_lab_A" = "old_label_1", ...)). Finally, you could modify the ggplot tables and rebuild the object.

Hope this is of any help.

aaronejaime commented 2 years ago

Thank you so much for the solutions!