Closed davidhodge931 closed 9 months ago
#' @title Light ggplot theme with inside legend
#'
#' @description Light theme for a ggplot visualisation with legend inside the panel. It uses the colours `"#121b24"`, `"#fcfdfe"`, and `"#ffffff"`.
#'
#' @inheritParams mode_i
#'
#' @return A ggplot theme.
#' @export
#'
#' @examples
#' library(palmerpenguins)
#' library(ggplot2)
#'
#' #set for a plot
#' penguins |>
#' gg_point(
#' x = flipper_length_mm,
#' y = body_mass_g,
#' col = species,
#' key_glyph = draw_key_rect,
#' theme = light_mode_i(legend_position_inside = c(0.125, 0.8))
#' )
#'
#' #set globally
#' \dontrun{
#' theme_set(light_mode_i(legend_position_inside = c(0.125, 0.8)))
#'
#' penguins |>
#' gg_point(
#' x = flipper_length_mm,
#' y = body_mass_g,
#' col = species,
#' key_glyph = draw_key_rect,
#' )
#' }
#'
light_mode_i <- function (
base_size = 11,
base_family = "",
legend_position_inside = c(0.5, 0.5)) {
mode_i(
base_size = base_size,
base_family = base_family,
legend_position_inside = legend_position_inside,
col_pal = lightness
)
}
Too much manual manipulation, and unclear how legend should be positioned/styled.
Better to get people to do this themseleves with
+ theme(legend.position = "inside")
etc