I’m trying to generate a plot combining 9 plots using the function plot_grid
.
Here is my script :
plot_grid(plot_grid(penchy, pver, pplante, ncol=3), plot_grid(p_adplante_benchy, p_adver_benchy, ncol=2), plot_grid(p_adplante_bver, p_adenchy_bver, ncol=2), plot_grid(p_adenchy_bplante, p_adver_bplante, col=2), ncol = 1 )
The displayed graphs looks like the image attached and the following error message occurs : Cannot convert object of class numeric into a grob.
The first row with 3 graphes is okay, the second row with two graphs is okay, the third row with 2 graphs is okay, but the last row looks “flattened”
More infos about the graphs you could need : y axis is always numeric, x axis is always a factor, and a discrete value (factor) is used to display the points with two different shapes and colors. I am using the last version of Rstudio (2024.04.2+764)
Do you have any idea what the problem is and how can I solve it ?
Thank you in advance 😉
I checked one by one all of my graphs and they all are gg
class. I tried to convert them as grob
, using grid.arrange
and arrangeGrob
but the result is exactly the same.
I tried to change the y scale of my last graph as it is really bigger than the other ones but nothing changes either.
When I print the graphs one by one, no problem seems to occur.
There is a blank thin line under the last line, I think the problem might be there but I have no idea how to deal with it…
mrlaperche is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2