I would like to add the marginal plots to a gglot2 object, so the axis match. However, I could not manage it with the insert_xaxis_grob and axis_canvas.
try this:
library(patchwork)
combined_plot <- insert_xaxis_grob(p01, wrap_plots(p05), position = "bottom") #wrap_plots would combine them as one
ggdraw(combined_plot)
I would like to add the marginal plots to a gglot2 object, so the axis match. However, I could not manage it with the insert_xaxis_grob and axis_canvas.
A very simple example
The major plot:
The margin, with facet_grid
combined_plot <- insert_xaxis_grob(p01, p05, position = "bottom") it gives the warning:
Any suggestions to add more than one marginal plots on the axis, as I would like to compare the distribution between different groups.
Thanks very much.