Skip to content

extra radii in some pie plots #44

Description

@leonardslog

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions