-
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
Function as data #1527
Function as data #1527
Conversation
Get up to data
Merge from hadley/master
…lve it if its a waiver or function
stop("Data function must return a data.frame") | ||
} | ||
return(data) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be better with no returns and a final else block
This is looking good. A few points:
|
…ents + examples of function as data
# Conflicts: # NEWS.md
All points have been addressed... |
@@ -101,6 +128,20 @@ Layer <- ggproto("Layer", NULL, | |||
cat(snakeize(class(self$position)[[1]]), "\n") | |||
}, | |||
|
|||
layer_data = function(self, plot_data) { | |||
if (is.waive(self$data)) { | |||
data <- plot_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop the data <-
in all the alternatives
One other idea now that I've merged it - what if the fortify happened in |
Possible error because of unknown data type will first happen when plotting - don't know if that is desirable? |
Should I redo the layer_data or is it merged and accepted and it was just a point for the future? |
Just a point for the future. I fixed locally |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
This is a follow up on PR #1486
Summary of changes:
fortify.function
that returns function unchangedlayer_data
method to Layer base class that takes the plot data as input and returns the data associated with the layermap_layout
layer_data
methodPossible additions: