Skip to content

theme_council() requires loading councilR first #91

@schroeder-matt

Description

@schroeder-matt

When I use theme_council() in ggplot2 without loading the councilR package first, I get the following error:

library(ggplot2)
data.frame(v1 = 1:5,
           v2 = 6:10) |> 
  ggplot(aes(x = v1, y = v2)) +
  geom_point(size = 4) +
  councilR::theme_council()

Error in colors$suppBlack : object of type 'closure' is not subsettable

Things are fine when I load the councilR package first, though. So could this be fixed by specifying that R should look to councilR for the colors object? Example, starting on line 188 of theme_council():

t <- ggplot2::theme(

    # SETUP -----
    line = ggplot2::element_line(
      colour = councilR::colors$suppBlack, # added "councilR::" here
      linewidth = base_line_size,
      linetype = 1,
      lineend = "butt"
    ),
    rect = ggplot2::element_rect(
      fill = councilR::colors$suppWhite, # added "councilR::" here
      colour = councilR::colors$suppBlack, # added "councilR::" here
      linewidth = base_rect_size,
      linetype = 1
    ),
...

I have no idea if this is desirable; if not, maybe the documentation should specify that you have to load councilR before using theme_council().

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions