We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
theme_axis_text_*_exception
theme_axis_text_x_exception <- function( exception = NULL, ..., colour = GeomText$default_aes$colour exception_colour = "transparent", ) { if (rlang::is_null(exception)) { ggplot2::theme(axis.text.x = ggplot2::element_text(colour = colour, ...)) } else if (!rlang::is_null(exception)) { all_plus_some <- 1:100 x_colours <- rep(exception_colour, time = length(exception)) names(x_colours) <- exception y_colours <- rep(colour, times = length(setdiff(all_plus_some, exception))) names(y_colours) <- setdiff(all_plus_some, exception) text_colours <- c(x_colours, y_colours)[as.character(sort(as.numeric(names(c(x_colours, y_colours)))))] ggplot2::theme(axis.text.x = ggplot2::element_text(colour = text_colours, ...)) } } theme_axis_ticks_x_exception <- function( exception = NULL, ..., colour = GeomHline$default_aes$colour, colour_exception= "transparent", linewidth = GeomHline$default_aes$linewidth ) { if (rlang::is_null(exception)) { ggplot2::theme(axis.ticks.x = ggplot2::element_line(colour = colour, linewidth = linewidth, ...)) } else if (!rlang::is_null(exception)) { all_plus_some <- 1:100 x_colours <- rep(colour_exception, time = length(exception)) names(x_colours) <- exception y_colours <- rep(colour, times = length(setdiff(all_plus_some, exception))) names(y_colours) <- setdiff(all_plus_some, exception) ticks_colours <- c(x_colours, y_colours)[as.character(sort(as.numeric(names(c(x_colours, y_colours)))))] ggplot2::theme(axis.ticks.x = ggplot2::element_line(colour = ticks_colours, linewidth = linewidth, ...)) } }
The text was updated successfully, but these errors were encountered:
Super manual...
library(ggplot2) library(dplyr) library(patchwork) library(palmerpenguins) p1 <- purrr::map( .x = sort(unique(penguins$species)), .f = function(x) { p <- penguins |> filter(species == x) %>% gg_blanket( x = flipper_length_mm, y = flipper_length_mm, col = species, subtitle = x, x_breaks_n = 4, x_expand_limits = range(penguins$flipper_length_mm, na.rm = T), y_expand_limits = range(penguins$flipper_length_mm, na.rm = T), ) + annotate_axis_line_x_bottom() + geom_point(size = 10, show.legend = TRUE) + theme(plot.title.position = "panel") + theme(plot.subtitle = element_text(hjust = 0.5, vjust = 11 * -0.66)) if (x == "Adelie") { p <- p + theme_axis_text_x_exception(1) + theme_axis_ticks_x_exception(1) } return(p) } ) |> wrap_plots() + plot_layout(guides = "collect", axes = "collect") p1 p2 <- penguins |> gg_point( x = flipper_length_mm, y = flipper_length_mm, col = species, facet = species, size = 10, ) p1 / p2
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: