Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions R/facet-.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ NULL
#' the default behaviour of one or more of the following methods:
#'
#' - `setup_params`:
#'
#' - `setup_panel_params`: modifies the x and y ranges for each panel. This is
#' used to allow the `Facet` to interact with the `panel_params`.
#'
#' - `init_scales`: Given a master scale for x and y, create panel
#' specific scales for each panel defined in the layout. The default is to
#' simply clone the master scale.
Expand Down Expand Up @@ -90,6 +94,7 @@ Facet <- ggproto("Facet", NULL,
map_data = function(data, layout, params) {
cli::cli_abort("Not implemented.")
},
setup_panel_params = function(self, panel_params, coord) panel_params,
init_scales = function(layout, x_scale = NULL, y_scale = NULL, params) {
scales <- list()
if (!is.null(x_scale)) {
Expand Down
5 changes: 4 additions & 1 deletion R/layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,15 @@ Layout <- ggproto("Layout", NULL,
scales_x <- self$panel_scales_x[self$layout$SCALE_X[index]]
scales_y <- self$panel_scales_y[self$layout$SCALE_Y[index]]

self$panel_params <- Map(
panel_params <- Map(
self$coord$setup_panel_params,
scales_x, scales_y,
MoreArgs = list(params = self$coord_params)
)[order] # `[order]` does the repeating

# Let Facet modify `panel_params` for each panel
self$panel_params <- self$facet$setup_panel_params(panel_params, self$coord)

invisible()
},

Expand Down
2 changes: 2 additions & 0 deletions man/ggplot2-ggproto.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading