leffj / mctoolsr

Microbial community analysis tools in R
http://leffj.github.io/mctoolsr/
20 stars 8 forks source link

minor figure edits #32

Closed cbfit closed 6 months ago

cbfit commented 5 years ago

Is there a way to alter the orientation of the relative abundances on the heatmap?

Is there a way to change the color scheme of the plot_taxa_bars command?

cliffbueno commented 4 years ago

The answer is yes to both.

To change the color scheme in plot_taxa_bars() you just need to add: + scale_fill_manual(values = c("color1","color2","color3")) after your plot_taxa_bars(), adding as many colors as there are factor levels and changing "color1" etc to whatever colors you want.

To alter the orientation of the relative abundances, I'm not exactly sure what you mean. If you want to flip the whole plot around, just add + coord_flip() after your plot_ts_heatmap() code. If by "alter the orientation of the relative abundances" you mean changing the angle of the text, you can copy the basic plot_ts_heatmap function here (lines 390-458) https://github.com/leffj/mctoolsr/blob/master/R/taxonomy-based.R, change the name of the function (maybe to "plot_ts_heatmap_angle" or something), go down to the line with: ggplot2::geom_text(data = to_plot, ggplot2::aes_string(label = "value"), size = 3) + and add whatever angle you want like so (change 90 to whatever angle you want): ggplot2::geom_text(data = to_plot, ggplot2::aes_string(label = "value"), size = 3, angle = 90) + Then run the function code so the new function "plot_ts_heatmap_angle" is in your environment, and use it the same as the original plot_ts_heatmap() function but the text will be angled as you want.