PediatricOpenTargets / OpenPedCan-api

2 stars 7 forks source link

Optimize boxplot right margin #36

Open logstar opened 3 years ago

logstar commented 3 years ago

After rotating boxplot x-axis labels 45 degrees, as suggested by @dunnpa, some right side labels are truncated by default right margin. To include all x-axis labels in the plot, the right margin is set with the following procedure. However, this procedure needs to be optimized for the following two purposes:

https://github.com/PediatricOpenTargets/OpenPedCan-api/blob/b265d7b74028c5d2dc126cea69cf043fe740ad7d/src/get_gene_tpm_boxplot.R#L75-L87

Example boxplot with truncated x-axis labels:

library(ggplot2)
data(diamonds)
diamonds$cut <- paste("Very very very long x-axis labels like our boxplot",as.character(diamonds$cut))
qplot(cut,carat,data=diamonds,geom="boxplot") +
  theme(axis.text.x = element_text(angle = -45, vjust = 1, hjust = 0))

image