Skip to content

Feature request: Let Facet act with the panel_params #6380

Closed
@Yunuuuu

Description

@Yunuuuu

I've implemented the feature discussed in #6262 and successfully created this facet. However, it requires a workaround using the following ggplot_add method to allow Facet to interact with panel_params:

#' @importFrom ggplot2 ggplot_add ggproto ggproto_parent
#' @export
ggplot_add.ggalign_facet_sector <- function(object, plot, object_name) {
    ParentLayout <- plot$layout
    plot$layout <- ggproto(
        NULL, ParentLayout,
        setup_panel_params = function(self) {
            ggproto_parent(ParentLayout, self)$setup_panel_params()
            if (!is.null(self$facet$setup_panel_params)) {
                self$panel_params <- self$facet$setup_panel_params(
                    self$coord, self$panel_params
                )
            }
            invisible()
        }
    )
    NextMethod()
}

If possible, I’d like to contribute this facet to the ggplot2 repository. Regarding the issue raised in #6262, I realized we can introduce a new theme element, sector.spacing, similar to panel.spacing, but defined in terms of theta rather than absolute units.

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions