I'm drawing a figure with two plots:
library(ggpubr)
library(ggplot2)
set.seed(123)
df <- data.frame(y= 1:20, x= sample(1:5, 20, replace= T))
A <- ggplot(df, aes(x, y)) + geom_point() + theme_bw() + labs(x= 'A (kg/mm^3)', y= 'B (%)')
B <- ggplot(df, aes(x, y)) + geom_point() + theme_bw() + labs(y= 'A (mm^2)', x= 'B (%)')
ggarrange(A, B)
When I include in one of the plots a superscript (in either the x or the y axis) the area of the plot reduces automatically a bit.
C <- ggplot(df, aes(x, y)) + geom_point() + theme_bw() + labs(x= expression(paste(paste("A (kg/", mm^3), ')')), y= expression('B (%)', c^2))
D <- ggplot(df, aes(x, y)) + geom_point() + theme_bw() + labs(y= expression(paste('A', mm^2)), x= expression('B (%)', c^2))
ggarrange(C, D)
I tried to reduce the area of the plot without a superscript by adding an expression that includes an invisible superscript (c^2) but the undesired area-reduction does not disappear.
