Home > OS >  Converting a hist() and boxplot() object into a ggplot() object to align my plots using plot_grid()
Converting a hist() and boxplot() object into a ggplot() object to align my plots using plot_grid()

Time:05-19

I am checking my data for normality and I have created boxplots - boxplot(), histograms - hist(), and ggqqplots() (using the ggpubr package, which is aligned with ggplot). The data shows measurements of acoustic parameters within spectrograms using Raven Software.

For this project, I need to visually represent my results neatly and I want to use plot_grid() in the cowplot Package to align my plots in 9 columns and 3 rows. I have produced 9 boxplots, 9 histograms, and 9 ggqqplot() objects.

When I attempted to align my plots using the plot_grid() function, the qqggplot() printed but the hist() and boxplots() objects did not (see diagram 1). I learned that I need to convert my hist() and boxplot() objects into grob objects.

I found a website (below) that stated could use as.glob() or as.ggplot() to convert my diagrams. I used the information from this link below, although, unsuccessfully.

enter image description here

CodePudding user response:

Have you tried using the grid.arrange() function of the gridExtra package ?

There is an example enter image description here

  • Related