I'm having some confusion with the size(s) of the grid.extra output.
I have the following ggplots:
k_uniforme <- covid %>%
drop_na(PC) %>%
ggplot(aes(x=PC)) +
stat_density(kernel = "rectangular", bw = hsilv, fill="#440154ff") +
labs(title="Uniform") +
theme_classic()
k_triangular <- covid %>%
drop_na(PC) %>%
ggplot(aes(x=PC)) +
stat_density(kernel = "triangular", bw = hsilv, fill="#7ad151ff") +
labs(title="Triangular") +
theme_classic()
k_gaussian <- covid %>%
drop_na(PC) %>%
ggplot(aes(x=PC)) +
stat_density(kernel = "gaussian", bw = hsilv, fill="#414487ff") +
labs(title="Gausiana") +
theme_classic()
k_epanechnikov <- covid %>%
drop_na(PC) %>%
ggplot(aes(x=PC)) +
stat_density(kernel = "epanechnikov", bw = hsilv, fill="#fde725ff") +
labs(title="Epanechnikov") +
theme_classic()
k_biweight <- covid %>%
drop_na(PC) %>%
ggplot(aes(x=PC)) +
stat_density(kernel = "biweight", bw = hsilv, fill="#fde725ff") +
labs(title="Epanechnikov") +
theme_classic()
And I want to print all of them in only one figure, preferably in the size of one entire page.
When I use the grid.arrange function for four of my plots I get the following output after kniting for pdf, which is very acceptable in terms of the size of the plots.
gridExtra::grid.arrange(k_uniforme, k_triangular, k_gaussian, k_epanechnikov, ncol=2, nrow=2)
However, when I want to arrange all of them (5 plots) the size of each plot is completely different and looks bad.
gridExtra::grid.arrange(k_uniforme, k_triangular, k_gaussian, k_epanechnikov, k_biweight, ncol=2, nrow=3)
My questions are the following: What is the default size of each plot in the 4plot-arrange? Is there any way to make the size of each plot in the 5plot-arrange similar to the one of the 4-plot arrange? And, How to center the 5th plot (i.e. the one in the third row) of the 5plot-arrange?
I've been searching for any help of grid.extra but the helps, blogs, etc. are really confusing. The document I'm trying to generate is a pdf using rmarkdown.
Thank you in advance!