I've a problem with saving a r-base plot to an object. I want to assign whole plot which in fact consists of two plots merged by layout()
function into a variable and then merge this plot with other by ggarrange()
function. The recordPlot()
function does not work cause I receive an error:
## Warning: Package `gridGraphics` is required to handle base-R plots.
## Substituting empty plot.
## Warning: Package `gridGraphics` is required to handle base-R plots.
## Substituting empty plot.
Here's the plot that I want to save:
layout(matrix(c(1, 2), 2, 1))
hist(X1209_HCC1806_cv$Absorbance)
boxplot(X1209_HCC1806_cv$Absorbance, horizontal = TRUE)
How does the gridGraphics package work? And how can I assign my plot to a variable in order to use it in ggarrange()
?
Claus is exactly right. You just need to install gridGraphics
with install.packages("gridGraphics")
. Your code worked perfectly for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With