Closed EvaMaeRey closed 10 months ago
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
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.
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.