Erin Gibbons
Erin Gibbons

Reputation: 1

How to specify overall plot size for fviz_pca_biplot of factoextra

I have created a PCA biplot using the code below. I need to specify the plot as a certain size (9 cm x 9cm), but have not figured out how to do so. I tried defining variables for the width and height and adding them using theme(plot.width..., but no luck.

    fviz_pca_biplot(res.pca, 
                    label = "var", 
                    select.var=list(contrib = 13),
                    col.var = "contrib", # Color by contributions to the PC
                    gradient.cols = c("#ffbf22", "#fa5f90", "#a057ff"),
                    repel = TRUE, #prevent overlapping labels
                    geom.label.size = 5, # Adjust the font size
                    xlab = "PC 1 (59.8%)", # Add a custom label for the X-axis
                    ylab = "PC 2 (23.5%)",  # Add a custom label for the Y-axis
                    title = NULL, #remove title
                    ggtheme = theme_light() # Set the theme to minimal
    )+ 
      coord_cartesian(xlim = c(-10, 4), ylim = c(-6, 2)) # customize x and y axis extents

Upvotes: 0

Views: 518

Answers (0)

Related Questions