Closed as not planned
Closed as not planned
Description
Facet$setup_data
is called by Layout
with all of the plot and layer data, as seen in Layout$Setup
:
data <- c(list(plot_data), data)
# Setup facets
self$facet_params <- self$facet$setup_params(data, self$facet$params)
self$facet_params$plot_env <- plot_env
data <- self$facet$setup_data(data, self$facet_params)
However, Facet$finish_data
is called repeatedly with each layer data in Layout$finish_data
:
finish_data = function(self, data) {
lapply(data, self$facet$finish_data,
layout = self$layout,
x_scales = self$panel_scales_x,
y_scales = self$panel_scales_y,
params = self$facet_params
)
}
Since Facet
is somewhat orthogonal to the layers (or at least applies to all the layers), it feels that the treatment in setup_data
is more appropriate.
It may be too late to change this, but I imagine usage of this method is rare enough that fixing it (assuming you agree this ideally would be fixed) might not be too painful in terms of breaking existing code.