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

Ordering of shapes is changed by arcPaths #224

Closed
dmurdoch opened this issue Feb 28, 2021 · 1 comment
Closed

Ordering of shapes is changed by arcPaths #224

dmurdoch opened this issue Feb 28, 2021 · 1 comment

Comments

@dmurdoch
Copy link
Contributor

This was reported on StackOverflow here: https://stackoverflow.com/q/66408402/2554330 . The following
code plots the circles in the wrong order, so the overlaps look wrong:

library(tidyverse)
library(ggforce)

circles <- data.frame(
    x0 = seq(1, 30),
    y0 = seq(1, 30),
    r = 2
)

ggplot() +
    geom_circle(aes(x0 = x0, y0 = y0, r = r), fill = "grey", data = circles) +
    coord_fixed()

Created on 2021-02-28 by the reprex package (v0.3.0)

The problem is that arcPaths uses base::make.unique() to construct group names for the shapes, and it doesn't preserve the original ordering. I'll submit a PR.

@dmurdoch
Copy link
Contributor Author

This is the same issue as thomasp85/ggraph#199 . I don't know which make_unique implementation is preferable; mine is faster on rep(1, 30), but ggraph:::make_unique is a lot faster on 1:30, and would often give shorter new names.

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