Selecting specific loadings for PCA with ggfortify/autoplot.

Hi,

I have created a PCA plot with ggfortify and plotly. On this PCA there are different species of bees visualised as loadings. Also the plots and their dominant tree species are visualised with colours ('Boomtype'). lastly 3 variabels of the plots are visualised as loadings on the PCA (authenticiteit=authenticity; totale_abundantie=total abundance; and Aantal bloemen=number of flowers).

My question now is: how do i seperate the different loadings of bee species from the 3 variabels so it is visible on 2 different graphs, but still using all data? There are also a lot of bee species with only 1 observation and this makes the graph messy and want to only visualize the most important species.
here is an example of how I want it:

My R code:
Bijen_df <- as.data.frame(PCA_Bijen) # eerst moet de tibble omgevormd worden naar een dataframe.
rownames(Bijen_df) <- c("B21","B22","B31","B32","B41","B42","B51","B52","B61","B62","B81","B82","B91","B92","O31","O32","O41","O42","O51","O52","O61","O62","O71","O72","P11","P12","P21","P22","P31","P32","P51","P52","P61","P62","P71","P72","P81","P82")

#Dan moet de eerste rij van plot verwijdert worden. en de andere rijen die geen bij zijn
PCA_Bijen_df <- Bijen_df %>% select(-Plot, -Boomtype)
PCA_Bijen_df
#dan wordt de data log getransformeerd.
PCA_Bijen_log <- log(PCA_Bijen_df+1) # we doen plus 1 want anders krijgen we '-inf' values en werkt de ggfortify niet.

PCA_Bijen2 <- prcomp(PCA_Bijen_log, scale. = TRUE)
p <- autoplot(PCA_Bijen2, data = Bijen_df, colour = "Boomtype",
shape = FALSE, label = TRUE, label.size = 3,
loadings = TRUE, loadings.colour = "black", loadings.label = TRUE, loadings.label.size = 3, loadings.label.colour = "black", frame = TRUE)+ theme_bw(base_size = 12)
ggplotly(p)

My data:

Plot Andrena_angustior Andrena_bicolor Andrena_cineraria Andrena_clarkella Andrena_dorsata Andrena_fulva Andrena_gravida Andrena_haemorrhoa Andrena_helvola Andrena_mitis Andrena_nitida Andrena_scotica Andrena_spec. Anthrophora_plumipes Apis_mellifera Bombus campestris Bombus hypnorum Bombus_lapidarius Bombus_lucorum Bombus_pascuorum Bombus_pratorum Bombus_terrestris Bombus_vestalis Bombus_spec. Halictus_tumulorum Halictus_scabiosae Lasioglossum_calceatum Lasioglossum_malachurum Lasioglossum_morio Lasioglossum_parvulum Lasioglossum_spec. Micrandrena_spec. Nomada_fabriciana Nomada_ferruginata Nomada_flava Nomada_flavoguttata Nomada_goodeniana Nomada_leucophthalma Nomada_panzeri Nomada_ruficornis Nomada_zonata Boomtype Authenticiteit Totale_abundantie Aantal_bloemen
B21 1 0 0 0 0 2 0 7 8 1 0 3 0 0 5 0 0 0 0 2 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 3 0 0 B 0.18 100 127
B22 0 0 0 0 0 1 0 4 7 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2 0 0 1 1 1 1 0 1 0 1 0 0 0 1 0 0 B 0.18 107 120
B31 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 B 0.2 100 35
B32 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 B 0.2 110 135
B41 0 0 0 0 1 1 0 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 B 0.31 100 7
B42 0 0 0 0 0 1 0 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 B 0.31 115 44
B51 0 0 0 0 0 0 0 4 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 B 0.56 100 270
B52 0 0 0 0 0 0 0 2 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 B 0.56 100 603
B61 0 0 0 0 0 0 0 7 5 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 0 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1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 P 0.55 70 927
P52 0 0 0 0 0 0 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 P 0.55 95 639
P61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 P 0.35 90 322
P62 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 P 0.35 125 14
P71 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 P 0.26 80 366
P72 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 P 0.26 110 336
P81 1 0 0 1 0 0 0 4 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 P 0.48 120 182
P82 0 0 0 0 0 0 0 0 3 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 P 0.48 110 327

This is the PCA plot i have now:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.