This function lets the user use pre-defined default colours.
Check your lares_pal()$labels
scale. Feel free to use
gg_vals()
to debug colours used in latest plot.
Usage
gg_fill_customs(column = "fill", ...)
gg_colour_customs(column = "colour", ...)
gg_text_customs(column = "colour", ...)
gg_vals(layer = "fill", column = layer, cols = NULL, ...)
Arguments
- column
Character. Select any of "fill" or "colour" to use on your
lares_pal()$labels
palette.- ...
Allow additional parameters not used.
- layer
Character. Select any of "fill", "colour", or "label" to get the layer containing the colours labels you wish to colour.
- cols
Data.frame. Customize colour palette with a data.frame. Must contain values, fill, and colour columns.
Details
Notice that when the layer defined is any of GeomPoint, GeomLine,
GeomText or GeomLabel, gg_colour_customs()
will force
column = "fill"
parameter.
See also
Other Themes:
lares_pal()
,
plot_palette()
,
theme_lares()
Examples
library("ggplot2")
# Generic plot function to run examples to
run_plot <- function(add_fxs = TRUE) {
p <- data.frame(station = c("spring", "summer", "fall", "winter"), num = 1:4) %>%
ggplot(aes(x = station, y = num, fill = station)) +
geom_col() +
geom_text(aes(y = 0.5, label = num, colour = station), size = 6)
if (add_fxs) p <- p + gg_fill_customs() + gg_colour_customs()
return(p)
}
# Default colours
run_plot()
# Check last colours used
gg_vals("fill", "fill")
#> spring summer fall winter
#> "#00C9AE" "#E63946" "#EA9A28" "#00B1DA"
gg_vals("colour", "colour")
#> spring summer fall winter
#> "#00C9AE" "#E63946" "#EA9A28" "#00B1DA"
# Change any default colour
options("lares.colours.custom" = data.frame(
values = c("summer", "winter"),
fill = c("pink", "black"),
colour = c("black", "white")
))
run_plot()
# Check last colours used
gg_vals("fill", "fill")
#> spring fall summer winter
#> "#00C9AE" "#EA9A28" "pink" "black"
gg_vals("colour", "colour")
#> spring fall summer winter
#> "#00C9AE" "#EA9A28" "pink" "black"
# Reset to default colours
options("lares.colours.custom" = NULL)
# Notice you can use 'pal = 4' argument on theme_lares() too
run_plot(add_fxs = FALSE) + theme_lares(pal = 4)
#> Maybe you meant one of these:
#> 'C059-BdIta', 'C059-Bold', 'C059-Italic', 'C059-Roman', 'D050000L', 'DejaVuMathTeXGyre', 'DejaVuSans', 'DejaVuSans-Bold', 'DejaVuSans-BoldOblique', 'DejaVuSans-ExtraLight', 'DejaVuSans-Oblique', 'DejaVuSansCondensed', 'DejaVuSansCondensed-Bold', 'DejaVuSansCondensed-BoldOblique', 'DejaVuSansCondensed-Oblique', 'DejaVuSansMono', 'DejaVuSansMono-Bold', 'DejaVuSansMono-BoldOblique', 'DejaVuSansMono-Oblique', 'DejaVuSerif', 'DejaVuSerif-Bold', 'DejaVuSerif-BoldItalic', 'DejaVuSerif-Italic', 'DejaVuSerifCondensed', 'DejaVuSerifCondensed-Bold', 'DejaVuSerifCondensed-BoldItalic', 'DejaVuSerifCondensed-Italic', 'DroidSansFallbackFull', 'Lato-Black', 'Lato-BlackItalic', 'Lato-Bold', 'Lato-BoldItalic', 'Lato-Hairline', 'Lato-HairlineItalic', 'Lato-Heavy', 'Lato-HeavyItalic', 'Lato-Italic', 'Lato-Light', 'Lato-LightItalic', 'Lato-Medium', 'Lato-MediumItalic', 'Lato-Regular', 'Lato-Semibold', 'Lato-SemiboldItalic', 'Lato-Thin', 'Lato-ThinItalic', 'LiberationMono-Bold', 'LiberationMono-BoldItalic', 'LiberationMono-Italic', 'LiberationMono-Regular', 'LiberationSans-Bold', 'LiberationSans-BoldItalic', 'LiberationSans-Italic', 'LiberationSans-Regular', 'LiberationSansNarrow-Bold', 'LiberationSansNarrow-BoldItalic', 'LiberationSansNarrow-Italic', 'LiberationSansNarrow-Regular', 'LiberationSerif-Bold', 'LiberationSerif-BoldItalic', 'LiberationSerif-Italic', 'LiberationSerif-Regular', 'NimbusMonoPS-Bold', 'NimbusMonoPS-BoldItalic', 'NimbusMonoPS-Italic', 'NimbusMonoPS-Regular', 'NimbusRoman-Bold', 'NimbusRoman-BoldItalic', 'NimbusRoman-Italic', 'NimbusRoman-Regular', 'NimbusSans-Bold', 'NimbusSans-BoldItalic', 'NimbusSans-Italic', 'NimbusSans-Regular', 'NimbusSansNarrow-Bold', 'NimbusSansNarrow-BoldOblique', 'NimbusSansNarrow-Oblique', 'NimbusSansNarrow-Regular', 'NotoColorEmoji', 'NotoMono-Regular', 'NotoSansMono-Bold', 'NotoSansMono-Regular', 'P052-Bold', 'P052-BoldItalic', 'P052-Italic', 'P052-Roman', 'StandardSymbolsPS', 'URWBookman-Demi', 'URWBookman-DemiItalic', 'URWBookman-Light', 'URWBookman-LightItalic', 'URWGothic-Book', 'URWGothic-BookOblique', 'URWGothic-Demi', 'URWGothic-DemiOblique', 'Z003-MediumItalic'