-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Better way of handling parameters #1516
Comments
Would it make sense to have a This would make it more analogous to how I think it would be relatively straightforward to do, but have to think more carefully about how to do this without negatively affecting extensions. Ideally they'd declare such a field, but it seems like quite a bit to ask without any immediate benefit. |
Yeah, that sounds reasonable at a high level. I'd want to see a PR implementing a very minimal version though, just to think more about it before we fully commit. |
I encountered an issue with the way parameters are determined, specifically the heuristic that they are taken from the formal arguments of I was creating a geom that was a small extension to GeomSfCustom <- ggplot2::ggproto("GeomSfCustom", ggplot2::GeomSf,
draw_panel = function(self, data, panel_params, coord, my_param = NULL, ...) {
# transform data with some function that uses my_param
print(my_param)
ggplot2::GeomSf$draw_panel(data, panel_params, coord, ...)
},
) I was finding that Line 80 in 2e649bb
and since Lines 186 to 190 in 2e649bb
I found a few ways to work around this but none seem ideal:
|
Currently the way we determine the parameters of a geom/stat is ugly. For example, the parameters of a geom are mostly imputed from
draw_panel
anddraw_group
, but some need to be listed explicitly inextra_args
if they're used elsewhere (as inGeomTile$setup_data()
.See also #1532 -
na.rm
also has to be special cased.The text was updated successfully, but these errors were encountered: