mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 04:27:30 +02:00
feat: added option to choose color palettes for all available plots. this includes a custom function to generate colors from several palettes as well as a select function to include color previews.
This commit is contained in:
parent
2d062e0ac5
commit
6c850847b7
21 changed files with 1110 additions and 251 deletions
45
man/scale_fill_generate.Rd
Normal file
45
man/scale_fill_generate.Rd
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/generate_colors.R
|
||||
\name{scale_fill_generate}
|
||||
\alias{scale_fill_generate}
|
||||
\alias{scale_color_generate}
|
||||
\title{Discrete and Continuous Fill Scale Using generate_colors}
|
||||
\usage{
|
||||
scale_fill_generate(palette = "viridis", discrete = TRUE, ...)
|
||||
|
||||
scale_color_generate(palette = "viridis", discrete = TRUE, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{palette}{Passed to \code{\link[=generate_colors]{generate_colors()}}. Either a palette name string
|
||||
or a function.}
|
||||
|
||||
\item{discrete}{\code{logical}. If \code{TRUE} (default), a discrete scale
|
||||
is returned. If \code{FALSE}, a continuous scale is returned.}
|
||||
|
||||
\item{...}{Additional arguments passed to \code{\link[ggplot2:scale_manual]{ggplot2::scale_fill_manual()}}
|
||||
(discrete) or \code{\link[ggplot2:scale_gradient]{ggplot2::scale_fill_gradientn()}} (continuous).}
|
||||
}
|
||||
\description{
|
||||
Drop-in replacement for \code{\link[viridis:scale_viridis]{viridis::scale_fill_viridis()}} that works with
|
||||
any palette supported by \code{\link[=generate_colors]{generate_colors()}}.
|
||||
}
|
||||
\examples{
|
||||
library(ggplot2)
|
||||
|
||||
# Discrete
|
||||
ggplot(mtcars, aes(x = wt, y = mpg, fill = factor(cyl))) +
|
||||
geom_col() +
|
||||
scale_fill_generate(palette = "Set1")
|
||||
|
||||
# Continuous
|
||||
ggplot(mtcars, aes(x = wt, y = mpg, fill = mpg)) +
|
||||
geom_point(shape = 21, size = 3) +
|
||||
scale_fill_generate(palette = "viridis", discrete = FALSE)
|
||||
|
||||
ggplot(mtcars, aes(x = wt, y = mpg, color = factor(cyl))) +
|
||||
geom_point() +
|
||||
scale_color_generate(palette = "Set1")
|
||||
}
|
||||
\seealso{
|
||||
\code{\link[=scale_color_generate]{scale_color_generate()}}, \code{\link[=generate_colors]{generate_colors()}}, \code{\link[=continuous_colors]{continuous_colors()}}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue