mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 04:27:30 +02:00
45 lines
1.6 KiB
R
45 lines
1.6 KiB
R
% 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()}}
|
|
}
|