saezlab / MetaProViz

R-package to perform metabolomics pre-processing, differential metabolite analysis, metabolite clustering and custom visualisations.
https://saezlab.github.io/MetaProViz/
GNU General Public License v3.0
10 stars 0 forks source link

Viz module: save plots in publication ready format #40

Closed ChristinaSchmidt1 closed 1 year ago

ChristinaSchmidt1 commented 1 year ago

For all the visualisation functions:

  1. we should first add the parameter of the margins, so the user can change them where needed
  2. We should set the x-y axis length to be always the same independent of the legend (e.g. in Volcano plot)
  3. We should set the x-y axis length to be always the same for bar/violin/box plot - e.g. 0.5cm per sample on the plot.
  4. For Heatmap and lollipop graph we should set the margins dependent on the amount of metabolites plotted on the axis and control that the font doesnt overlap.
  5. Generally we should add a paramter to all functions (e.g. Volcano/Lollipop graph) that will automatically label on the plot XXX Metabolites, so the user could pass that they dont plot Metabolites, but e.g. Proteins (metabolic enzymes)
ChristinaSchmidt1 commented 1 year ago

Also:

  1. save_as=NULL --> do not save the plots that are generated
  2. Always return the plots in an object to the environment, so that the user could further adapt the plot settings and add their own instructions for saving formats
ChristinaSchmidt1 commented 1 year ago

Ok I have made some progress here and finally understodd the syntax of the ggplot margins. I have already added in some functionality for the Volcano plots and it is really neat. I am thinking of starting to move some things from the functions into helper functions as they become quite long.

ChristinaSchmidt1 commented 1 year ago

Done for PCA and Volcano plot! One thing to potenntially improve here is: If the Figure title/subtitle is too long it is cut off. So I will try to figure out how to translate the number of characters (with spaces) would translate into cm on the plot.

ChristinaSchmidt1 commented 1 year ago

Done for Heatmap. I found a way to extract the gtable object and was able to proceed similar to Volcano/PCA.

ChristinaSchmidt1 commented 1 year ago

Fixed the cutoff of the figure title subtitle.

New issue I saw: If we change the theme in e.g. volcano plot it doesnt save the plot that nicely anymore especially when having large figure legends. Also the legend label is added and it passes on the whole set of parameters.

ChristinaSchmidt1 commented 1 year ago

I will close this as I have implemented all of this for the main Viz functions and submit now individual issues for the remaining Viz functions (lollipop and Bar) to adapt it there