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

x0, y0, r0, r default aes #313

Closed
EvaMaeRey opened this issue Nov 9, 2023 · 2 comments
Closed

x0, y0, r0, r default aes #313

EvaMaeRey opened this issue Nov 9, 2023 · 2 comments

Comments

@EvaMaeRey
Copy link
Contributor

Thank you for ggforce!

I'm wondering, if x0, y0, r0, r were not required, but had defaults, could geom_are_bar and friends be easier to use?

I've tried using the following code to creating the vectors as needed when aes is not provided by user:

if(!("x0" %in% names(data))){data$x0 <- 0}
if(!("y0" %in% names(data))){data$y0 <- 0}
if(!("r0" %in% names(data))){data$r0 <- 0}
if(!("r" %in% names(data))){data$r <- 1}

This allows these aesthetics to be move to default_aes:

required_aes = c('start', 'end'),
default_aes = aes(x0 = NULL, y0 = NULL, r0 = NULL, r = NULL)

I hope that makes sense. Testing it out here: https://evamaerey.github.io/mytidytuesday/2023-11-08-ggforce-pies/ggforce-pies.html

I can prepare a pull request if you are open to this change and don't think it would introduce side effects. Perhaps there is another, better way too.

@thomasp85
Copy link
Owner

I remember being quite deliberate about providing defaults since there is no "default location" for an arc in the same way as there is no default location for a line...

I know if you often plot arcs from a unit circle these seem like reasonable defaults but this is not necessarily the only use for this

@EvaMaeRey
Copy link
Contributor Author

Yep, I was interested in the unit circle affording quick pie chart. It does seem making positional aesthetics required aes is consistent with how most stats/geoms functions are written; so I can see where you are coming from.

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