Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: nice colourbars via unsupported hack #999

Open
davidhodge931 opened this issue Nov 20, 2024 · 2 comments
Open

docs: nice colourbars via unsupported hack #999

davidhodge931 opened this issue Nov 20, 2024 · 2 comments

Comments

@davidhodge931
Copy link
Owner

davidhodge931 commented Nov 20, 2024

No description provided.

@davidhodge931
Copy link
Owner Author

davidhodge931 commented Jan 30, 2025

# for use with col_breaks = \(x) x, theme = light_mode_r(),
theme_colourbar_r <- function(
    legend_key_width = ggplot2::rel(1),
    legend_key_height = ggplot2::rel(1.5)
  ) {
  rlang::list2(
    theme(legend.text = element_text(vjust = c(0, 1))), #unsupported hack
    theme(legend.key.width = legend_key_width),
    theme(legend.key.height = legend_key_height),
    theme(legend.ticks = element_line(colour = "transparent"))
  )
}

# for use with col_breaks = \(x) x, theme = light_mode_t(),
theme_colourbar_t <- function(
    legend_key_width = ggplot2::rel(1.66),
    legend_key_height = ggplot2::rel(0.9)
) {
  rlang::list2(
    theme(legend.text = element_text(hjust = c(0, 1))), #unsupported hack
    theme(legend.key.width = legend_key_width),
    theme(legend.key.height = legend_key_height),
    theme(legend.ticks = element_line(colour = "transparent"))
  )
}

@davidhodge931
Copy link
Owner Author

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant