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

extra radii in some pie plots #44

Open
leonardslog opened this issue Sep 28, 2023 · 0 comments
Open

extra radii in some pie plots #44

leonardslog opened this issue Sep 28, 2023 · 0 comments

Comments

@leonardslog
Copy link

leonardslog commented Sep 28, 2023

Hello,

Thank you for the incredibly helpful package. I am encountering an issue while trying to display spatial admixture patterns in a dataset of 34 samples representing 3 populations. a few of which have the same coordinates, which shouldn't be a problem. 4 of the samples seem to have extra radii, splitting what should be a continuous slice of the same color into multiple ones. All rows of admixture proportions seem to appropriately sum to 1. Changing the alpha value reveals that some of these might be the samples that have additional samples in the same location, but that doesn't explain the extra slices, since with no transparency, the samples simply shouldn't be visible. The columns representing the admixture proportions are columns 2:4 (X3, X1, X2), while the long and lat coordinates are columns 5:6 (V2, V3).

Any idea what's happening? Code is below and I've attached the data and the resulting plot.

EDIT: just saw that this is addressed in #36 , so feel free to delete. I will add that upon playing with the data, I found this occurs in samples that have share only one of the same coordinates, not both, and rounding (in my case to the 100th decimal place) seems to help, though might be impractical in larger datasets where spatially overlapping samples might have meaningful and unique admixture patterns.

library(ggplot2)
library(scatterpie)
library(ggnewscale)

df <- read.csv("df.csv")

ggplot() +
  new_scale_fill() +
  geom_scatterpie(aes(x=V2, y=V3, r = 0.25),
                  data = df, cols = colnames(df[,2:4])) +
  theme_classic() +
  theme(legend.position = "none",
        axis.line = element_line(linewidth = 0, colour = NULL),
        panel.border = element_rect(linewidth = 1, linetype = "solid", colour = "black", fill = NA))

df.csv
map_troubleshoot

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

1 participant