I stole the example below (original found http://www.sthda.com/english/articles/24-ggpubr-publication-ready-plots/81-ggplot2-easy-way-to-mix-multiple-graphs-on-the-same-page/#align-plot-panels). The output center aligns the table within the figure, but I want to center align the table to the x-axis label of the plot above. What is the easiest way to do this?
library("ggpubr")
library("grid")
library("gridExtra")
# Density plot of "Sepal.Length"
#::::::::::::::::::::::::::::::::::::::
density.p <- ggdensity(iris, x = "Sepal.Length",
fill = "Species", palette = "jco")
# Draw the summary table of Sepal.Length
#::::::::::::::::::::::::::::::::::::::
# Compute descriptive statistics by groups
stable <- desc_statby(iris, measure.var = "Sepal.Length",
grps = "Species")
stable <- stable[, c("Species", "length", "mean", "sd")]
# Summary table plot, medium orange theme
stable.p <- ggtexttable(stable, rows = NULL,
theme = ttheme("mOrange"))
p <- arrangeGrob(density.p, stable.p,
ncol = 1,
heights = c(2, 1))
grid.draw(p)
This is the output.
This is the output I would like (table shifted to right to align with x axis label).
question from:
https://stackoverflow.com/questions/65831927/center-align-table-grob-to-x-axis-label 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…