If I'm understanding the question correctly, one quick way to manage this is to use gridextra and grid since it allows you to interact with graphical objects. Below is my code step by step:
library(ggplot2)
library(FactoMineR)
library(factoextra)
#load gridExtra
library(gridExtra)
#save as an object within global environment
irispca <- PCA(iris,quali.sup = 5)
plots<- fviz_pca_var(irispca)+
theme(text = element_text(size = 7.5),
axis.title = element_text(size = 7.5),
axis.text = element_text(size = 7.5))
)
#use grid.arrange from gridextra to adjust the widths and heights
# to your liking. You can do this multiple plots if you wanted to
#but grid.arrange offers a quick workaround
grid.arrange(plots,widths = unit(6,"cm"))
If you want to delve into ggplot_grob and the get more specific, you can edit the gtable of the ggplot object using ggplot_grob. Using this you can manipulate the gtable arguments directly.You can do so with the following and inspect the gtable arguments to you need.
library(ggplot2)
library(FactoMineR)
library(factoextra)
library(gridExtra)
irispca <- PCA(iris,quali.sup = 5)
plots<- fviz_pca_var(irispca)+
theme(text = element_text(size = 7.5),
axis.title = element_text(size = 7.5),
axis.text = element_text(size = 7.5))
)
library(gtable)
plottable<- ggplotGrob(plots)
plottable$widths[4:6] <- unit(3, "cm")
grid.newpage()
gtable_show_layout(plottable)
grid.draw(plottable)
`
You can adjust accordingly but here is an image of how the plot layout looks with the above code along with the characteristics. plottable$layout will also help understand each of the zones within the gtable object that gets plotted.
EDIT: In response to the comment below, here is further specification to change the x-axis to 4 cm and the plot itself to 6. grid.newpage isn't as important as long as grid.draw and gtable_show_layout work.
library(ggplot2)
library(FactoMineR)
library(factoextra)
library(gridExtra)
library(gtable)
library(grid)
irispca <- PCA(iris,quali.sup = 5)
plots<- fviz_pca_var(irispca)+
theme(text = element_text(size = 7.5),
axis.title = element_text(size = 7.5),
axis.text = element_text(size = 7.5))
)
plottable<- ggplotGrob(plots)
plottable$widths[5] <- unit(4, "cm")#controls x-axis
plottable$widths[c(4,6)] <- unit(1,"cm")#controls margins
grid.newpage()
gtable_show_layout(plottable)
grid.draw(plottable)#to just get the plot, do not use the gtable_show_layout
plot(plottable) #if grid.draw does not work, just use the plot function and it should plot it correctly. Note: this will only work if the widths were adjusted correctly in plottable.