Title: | Colors Palettes for R and 'ggplot2', Additional Themes for 'ggplot2' |
---|---|
Description: | Contains a selection of color palettes and 'ggplot2' themes designed by the package author. |
Authors: | Jared Huling [aut, cre] |
Maintainer: | Jared Huling <[email protected]> |
License: | GPL-2 |
Version: | 0.0.5 |
Built: | 2025-01-25 04:04:15 UTC |
Source: | https://github.com/jaredhuling/jcolors |
Creates different vectors of related colors that may be useful for figures.
display_all_jcolors()
display_all_jcolors()
display_all_jcolors()
display_all_jcolors()
displays all of the continuous jcolors palettes
display_all_jcolors_contin()
display_all_jcolors_contin()
display_all_jcolors_contin()
display_all_jcolors_contin()
displays the discrete jcolors palettes
display_jcolors( palette = c("default", "pal2", "pal3", "pal4", "pal5", "pal6", "pal7", "pal8", "pal9", "pal10", "pal11", "pal12", "rainbow") )
display_jcolors( palette = c("default", "pal2", "pal3", "pal4", "pal5", "pal6", "pal7", "pal8", "pal9", "pal10", "pal11", "pal12", "rainbow") )
palette |
Character string indicating a palette of colors. |
display_jcolors()
display_jcolors()
displays the continuous jcolors palettes
display_jcolors_contin( palette = c("default", "pal2", "pal3", "pal4", "pal10", "pal11", "pal12", "rainbow") )
display_jcolors_contin( palette = c("default", "pal2", "pal3", "pal4", "pal10", "pal11", "pal12", "rainbow") )
palette |
Character string indicating a palette of colors. |
display_jcolors_contin()
display_jcolors_contin()
Creates different vectors of related colors that may be useful for figures.
jcolors( palette = c("default", "pal2", "pal3", "pal4", "pal5", "pal6", "pal7", "pal8", "pal9", "pal10", "pal11", "pal12", "rainbow") )
jcolors( palette = c("default", "pal2", "pal3", "pal4", "pal5", "pal6", "pal7", "pal8", "pal9", "pal10", "pal11", "pal12", "rainbow") )
palette |
Character string indicating a palette of colors. |
Vector of character strings representing the chosen palette of colors.
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)
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)
Creates different color palette functions
jcolors_contin( palette = c("default", "pal2", "pal3", "pal4", "pal10", "pal11", "pal12", "rainbow"), reverse = FALSE, interpolate = c("spline", "linear"), ... )
jcolors_contin( palette = c("default", "pal2", "pal3", "pal4", "pal10", "pal11", "pal12", "rainbow"), reverse = FALSE, interpolate = c("spline", "linear"), ... )
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 |
returns a function that takes an integer argument (the required number of colors), which then returns a character vector of colors
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")
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
jcolors color scales
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"), ... )
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"), ... )
palette |
Character string indicating a palette of colors. |
... |
additional parameters for |
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")
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
minimal theme for light backgrounds
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 )
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 )
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 |
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()
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()