Skip to content

Difficulty generating a colored PCA plot using gg_pca() with metadata #67

@MarquesMat

Description

@MarquesMat

I am unable to generate a colored PCA plot as demonstrated in the example from the associated publication (https://pmc.ncbi.nlm.nih.gov/articles/PMC8487088/pdf/main.pdf).

The code I am using is as follows:

pca2 <- p2$pan_pca() summary(pca2) p2$gg_pca(color = "Host", size = 4) + theme_bw(base_size = 15) + scale_color_brewer(palette = "Set2")

I have successfully added the metadata to the Pagoo object, which can be verified by the output of p2$organisms:

p2$organisms
DataFrame with 162 rows and 2 columns
org Host

1 data_GCA_018679695.1 Maribacter_A sp01867
2 data_GCA_019931105.1 Maribacter_D sp01993
3 data_GCA_024228355.1 Maribacter_A sp02422
... (and 159 more rows)

Despite the metadata being present and correctly formatted (162 organisms mapped to 66 different hosts), the resulting PCA plot lacks color differentiation and all points appear in a single color (black).

I would appreciate any guidance on how to resolve this issue and achieve the colored PCA visualization as intended.

Thank you for your assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions