Type: | Package |
Title: | Colors Palettes for R and 'ggplot2', Additional Themes for 'ggplot2' |
Version: | 0.0.5 |
Description: | Contains a selection of color palettes and 'ggplot2' themes designed by the package author. |
URL: | https://jaredhuling.org/jcolors/ |
BugReports: | https://github.com/jaredhuling/jcolors/issues |
License: | GPL-2 |
Encoding: | UTF-8 |
Depends: | R (≥ 3.2.0) |
Imports: | grDevices, scales, ggplot2 (≥ 3.0.0) |
RoxygenNote: | 7.3.1 |
Suggests: | knitr, rmarkdown, gridExtra |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2024-03-28 16:53:28 UTC; huling |
Author: | Jared Huling |
Maintainer: | Jared Huling <jaredhuling@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-03-29 16:00:06 UTC |
Display all jcolors
Description
Creates different vectors of related colors that may be useful for figures.
Usage
display_all_jcolors()
Examples
display_all_jcolors()
Display every jcolors_contin palette
Description
displays all of the continuous jcolors palettes
Usage
display_all_jcolors_contin()
Examples
display_all_jcolors_contin()
Display jcolors
Description
displays the discrete jcolors palettes
Usage
display_jcolors(
palette = c("default", "pal2", "pal3", "pal4", "pal5", "pal6", "pal7", "pal8", "pal9",
"pal10", "pal11", "pal12", "rainbow")
)
Arguments
palette |
Character string indicating a palette of colors. |
Examples
display_jcolors()
Display jcolors_contin
Description
displays the continuous jcolors palettes
Usage
display_jcolors_contin(
palette = c("default", "pal2", "pal3", "pal4", "pal10", "pal11", "pal12", "rainbow")
)
Arguments
palette |
Character string indicating a palette of colors. |
Examples
display_jcolors_contin()
Vectors of colors for figures
Description
Creates different vectors of related colors that may be useful for figures.
Usage
jcolors(
palette = c("default", "pal2", "pal3", "pal4", "pal5", "pal6", "pal7", "pal8", "pal9",
"pal10", "pal11", "pal12", "rainbow")
)
Arguments
palette |
Character string indicating a palette of colors. |
Value
Vector of character strings representing the chosen palette of colors.
Examples
par(mar=c(0.6,5.1,0.6,0.6))
plot(0, 0, type = "n", xlab = "", ylab = "", xlim = c(0, 6), ylim = c(4, 0), yaxs = "i",
xaxt = "n", yaxt = "n", xaxs = "i")
axis(side=3, at=1:3, c("default", "pal2", "pal3"), las=1)
def <- jcolors("default")
points(seq(along = def), rep(1, length(def)), pch = 22, bg = def, cex = 8)
pal2 <- jcolors("pal2")
points(seq(along = pal2), rep(2, length(pal2)), pch = 22, bg = pal2, cex = 8)
pal3 <- jcolors("pal3")
points(seq(along = pal3), rep(3, length(pal3)), pch = 22, bg = pal3, cex = 8)
continuous palettes of colors for figures
Description
Creates different color palette functions
Usage
jcolors_contin(
palette = c("default", "pal2", "pal3", "pal4", "pal10", "pal11", "pal12", "rainbow"),
reverse = FALSE,
interpolate = c("spline", "linear"),
...
)
Arguments
palette |
Character string indicating a palette of colors. |
reverse |
logical value indicating whether the color palette should be reversed. Defaults
to |
interpolate |
Character string for color interpolation method. "linear" or "spline" interpolation available |
... |
other arguments to be passed to |
Value
returns a function that takes an integer argument (the required number of colors), which then returns a character vector of colors
Examples
colfunc <- jcolors_contin()
jcols <- colfunc(1000)
n <- length(jcols)
image(1:n, 1, as.matrix(1:n),
col = jcols,
xlab = "", ylab = "",
xaxt = "n", yaxt = "n", bty = "n")
continuous jcolors color scales
Description
continuous jcolors color scales
jcolors color scales
Usage
scale_color_jcolors_contin(
palette = c("default", "pal2", "pal3", "pal4", "pal10", "pal11", "pal12", "rainbow"),
...
)
scale_colour_jcolors_contin(
palette = c("default", "pal2", "pal3", "pal4", "pal10", "pal11", "pal12", "rainbow"),
...
)
scale_fill_jcolors_contin(
palette = c("default", "pal2", "pal3", "pal4", "pal10", "pal11", "pal12", "rainbow"),
...
)
scale_color_jcolors(
palette = c("default", "pal2", "pal3", "pal4", "pal5", "pal6", "pal7", "pal8", "pal9",
"pal10", "pal11", "pal12", "rainbow"),
...
)
scale_colour_jcolors(
palette = c("default", "pal2", "pal3", "pal4", "pal5", "pal6", "pal7", "pal8", "pal9",
"pal10", "pal11", "pal12", "rainbow"),
...
)
scale_fill_jcolors(
palette = c("default", "pal2", "pal3", "pal4", "pal5", "pal6", "pal7", "pal8", "pal9",
"pal10", "pal11", "pal12", "rainbow"),
...
)
Arguments
palette |
Character string indicating a palette of colors. |
... |
additional parameters for |
Examples
library(ggplot2)
plt <- ggplot(data.frame(x = rnorm(10000), y = rexp(10000, 1.5)), aes(x = x, y = y)) +
geom_hex() + coord_fixed()
plt + scale_fill_jcolors_contin() + theme_bw()
plt + scale_fill_jcolors_contin("pal2", bias = 1.5) + theme_bw()
plt + scale_fill_jcolors_contin("pal3") + theme_bw()
library(ggplot2)
data(morley)
pltl <- ggplot(data = morley, aes(x = Run, y = Speed,
group = factor(Expt),
colour = factor(Expt))) +
geom_line(size = 2) +
theme_bw() +
theme(panel.background = element_rect(fill = "grey97"),
panel.border = element_blank())
pltd <- ggplot(data = morley, aes(x = Run, y = Speed,
group = factor(Expt),
colour = factor(Expt))) +
geom_line(size = 2) +
theme_bw() +
theme(panel.background = element_rect(fill = "grey15"),
panel.border = element_blank(),
panel.grid.major = element_line(color = "grey45"),
panel.grid.minor = element_line(color = "grey25"))
pltl + scale_color_jcolors(palette = "default")
pltd + scale_color_jcolors(palette = "default")
minimal theme for dark backgrounds
Description
minimal theme for dark backgrounds
minimal theme for light backgrounds
Usage
theme_dark_bg(
base_size = 12,
base_family = "sans",
base_line_size = base_size/22,
base_rect_size = base_size/22
)
theme_light_bg(
base_size = 12,
base_family = "sans",
base_line_size = base_size/22,
base_rect_size = base_size/22
)
Arguments
base_size |
base font size, given in pts. |
base_family |
base font family |
base_line_size |
base size for line elements |
base_rect_size |
base size for rect elements |
Examples
library(ggplot2)
p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg,
colour = factor(gear))) + facet_grid(vs~am)
p + theme_dark_bg()
p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg,
colour = factor(gear))) + facet_grid(vs~am)
p + theme_light_bg()