Skip to content

Labelling samples in ord_plot PCoA #156

Answered by david-barnett
we32i225 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, do you mean label each individual point, or each colour/shape group?

If individual points, you should be able to add geom_text, or (maybe better geom_text_repel from ggrepel package) to the plot.
set the label aesthetic e.g. geom_text_repel(aes(label = NAMEOFVARIABLEYOUWANTTOLABELWITH))

This will be pretty crowded though, so you might also want to filter the points you label, e.g. by setting the data argument to a filtering function in the geom to e.g. geom_text(data = function(df) filter(df, variable == "value"), mapping = aes(...))

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by david-barnett
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #155 on May 30, 2024 09:12.