Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a black border to plotted colored points #35

Closed
parcbioinfo opened this issue Nov 16, 2020 · 2 comments
Closed

Adding a black border to plotted colored points #35

parcbioinfo opened this issue Nov 16, 2020 · 2 comments

Comments

@parcbioinfo
Copy link

parcbioinfo commented Nov 16, 2020

Hi Kevin, I am trying to add a black border to the colored points in biplot (usually, in R I use pch=21) but have not been able to. How do I change the shape of all points (they are colored by "group") to filled-in circles with a black border (keeping the colors that are already in place)? I need this rather than shape by group because it will help to distinguish multiple points when they are close together.

@kevinblighe
Copy link
Owner

Hi! PCAtools is mainly based on ggplot2, so, you have to go by the ggplot2 shape codes. The same effect that you want can be availed of via the following parameters, I think:

shape = NUL
shapekey = NULL

There are sections in the vignette about these.

@parcbioinfo
Copy link
Author

parcbioinfo commented Nov 18, 2020

Yes, I got it. Thank you! Here is the code (in case anybody else needs to find out how to do it) that worked the way I needed it to:
biplot(p, lab=NULL, hline = 0, vline = 0, colby = 'Group', colkey = c('A.C'='yellow', 'A.E'='purple', 'H.C'='blue', 'H.E'='darkgreen', 'O.C'='darkblue', 'O.E'='red', 'P.C'='brown', 'P.E'='black'), legendPosition = 'right', drawConnectors = F, gridlines.major = FALSE gridlines.minor = FALSE, pointSize = 3.5) +
geom_point(shape = 21,size = 3.5,colour = "black") +
theme(text = element_text(size = 20), axis.text.x = element_text(size = 20), axis.text.y = element_text(size = 20), legend.key=element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), panel.border = element_rect(linetype = "solid", fill = NA))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants