Skip to content

panel.heights & panel.widths behaviour when unit length = 1 #6496

Closed
@davidhodge931

Description

@davidhodge931

Awesome new feature in setting panel widths and heights!

I am a big advocate for setting as much as possible theme/style stuff upfront.

So I'd be inclined to set panel heights and widths with set_theme.

Ideally I'd just do:

set_theme(
            theme_classic() +
            theme(
              panel.widths = unit(5, "cm"),
              panel.heights = unit(5, "cm")
            )

However , this won't work as I might have guessed when facetting because of the special behaviour.

Somewhat special behaviour occurs if you give a unit of length 1, but you have multiple panels. In that case, the total panel area is set, rather than the size of individual panels.

To get around this and ensure any amount of facetting would produce uniform panel sizes, I could:

set_theme(
            theme_classic() +
            theme(
              panel.widths = unit(rep(5, times=100), "cm"),
              panel.heights = unit(rep(5, times=100), "cm")
            )

I think what most people want is to easily set consistent panel sizes. So I wonder whether this special feature is worthwhile considering the potential confusion it'll cause? It seems like an edge case scenario, and also doesn't really align with intuitive meaning of the argument names..

Another way could be to have a panel.widths.total = NULL and panel.heights.total = NULL arguments ??

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