All Projects → jaredhuling → jcolors

jaredhuling / jcolors

Licence: other
A set of color palettes I like (or can at least tolerate)

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to jcolors

Naniar
Tidy data structures, summaries, and visualisations for missing data
Stars: ✭ 557 (+2220.83%)
Mutual labels:  ggplot2, r-package
Ggparliament
Simple parliament plots using ggplot2
Stars: ✭ 130 (+441.67%)
Mutual labels:  ggplot2, r-package
Tidybayes
Bayesian analysis + tidy data + geoms (R package)
Stars: ✭ 557 (+2220.83%)
Mutual labels:  ggplot2, r-package
Bayesplot
bayesplot R package for plotting Bayesian models
Stars: ✭ 276 (+1050%)
Mutual labels:  ggplot2, r-package
ggHoriPlot
A user-friendly, highly customizable R package for building horizon plots in ggplot2
Stars: ✭ 115 (+379.17%)
Mutual labels:  ggplot2, r-package
Ggextra
📊 Add marginal histograms to ggplot2, and more ggplot2 enhancements
Stars: ✭ 299 (+1145.83%)
Mutual labels:  ggplot2, r-package
Gratia
ggplot-based graphics and useful functions for GAMs fitted using the mgcv package
Stars: ✭ 102 (+325%)
Mutual labels:  ggplot2, r-package
Ggpointdensity
📈 📊 Introduces geom_pointdensity(): A Cross Between a Scatter Plot and a 2D Density Plot.
Stars: ✭ 286 (+1091.67%)
Mutual labels:  ggplot2, r-package
sportyR
R package for drawing regulation playing surfaces for several sports
Stars: ✭ 84 (+250%)
Mutual labels:  ggplot2, r-package
Ggdist
Visualizations of distributions and uncertainty
Stars: ✭ 197 (+720.83%)
Mutual labels:  ggplot2, r-package
Tidymv
Tidy Model Visualisation for Generalised Additive Models
Stars: ✭ 25 (+4.17%)
Mutual labels:  ggplot2, r-package
mapr
Map species occurrence data
Stars: ✭ 34 (+41.67%)
Mutual labels:  ggplot2, r-package
Plotly
An interactive graphing library for R
Stars: ✭ 2,096 (+8633.33%)
Mutual labels:  ggplot2, r-package
TDAstats
R pipeline for computing persistent homology in topological data analysis. See https://doi.org/10.21105/joss.00860 for more details.
Stars: ✭ 26 (+8.33%)
Mutual labels:  ggplot2, r-package
cusumcharter
Easier CUSUM control charts. Returns simple CUSUM statistics, CUSUMs with control limit calculations, and function to generate faceted CUSUM Control Charts
Stars: ✭ 17 (-29.17%)
Mutual labels:  ggplot2, r-package
rsnps
Wrapper to a number of SNP web APIs
Stars: ✭ 44 (+83.33%)
Mutual labels:  r-package
30diasdegraficos
30 tipos de gráficos hechos con R, con datos y código reproducible.
Stars: ✭ 47 (+95.83%)
Mutual labels:  ggplot2
ECoL
Extended Complexity Library in R
Stars: ✭ 45 (+87.5%)
Mutual labels:  r-package
calendar
R interface to iCal (.ics files)
Stars: ✭ 30 (+25%)
Mutual labels:  r-package
bigstatsr
R package for statistical tools with big matrices stored on disk.
Stars: ✭ 139 (+479.17%)
Mutual labels:  r-package

jcolors intro

version Build Status

jcolors contains a selection of ggplot2 color palettes that I like (or can at least tolerate to some degree)

Installation

Install jcolors from GitHub:

install.packages("devtools")
devtools::install_github("jaredhuling/jcolors")

Access the jcolors color palettes with jcolors():

library(jcolors)

jcolors('default')
##        kelly_green rich_electric_blue        maximum_red 
##          "#29BF12"          "#00A5CF"          "#DE1A1A" 
##     majorelle_blue fluorescent_orange 
##          "#574AE2"          "#FFBF00"

Display all available palettes

Discrete palettes

display_all_jcolors()

Continuous palettes

display_all_jcolors_contin()

Discrete Color Palettes

Use with ggplot2

Now use scale_color_jcolors() with ggplot2:

library(ggplot2)
library(gridExtra)

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(),
          legend.position = "bottom")

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"),
          legend.key = element_rect(fill = "grey15"),
          panel.border = element_blank(),
          panel.grid.major = element_line(color = "grey45"),
          panel.grid.minor = element_line(color = "grey25"),
          legend.position = "bottom")

grid.arrange(pltl + scale_color_jcolors(palette = "default"),
             pltd + scale_color_jcolors(palette = "default"), ncol = 2)

grid.arrange(pltl + scale_color_jcolors(palette = "pal2"),
             pltd + scale_color_jcolors(palette = "pal2"), ncol = 2)

Color palettes can be displayed using display_jcolors()

default

display_jcolors("default")

pal2

display_jcolors("pal2")

pal3

display_jcolors("pal3")

pal4

display_jcolors("pal4")

pal5

display_jcolors("pal5")

pal6

display_jcolors("pal6")

pal7

display_jcolors("pal7")

pal8

display_jcolors("pal8")

pal9

display_jcolors("pal9")

pal10

display_jcolors("pal10")

pal11

display_jcolors("pal11")

pal12

display_jcolors("pal12")

rainbow

display_jcolors("rainbow")

More example plots

grid.arrange(pltl + scale_color_jcolors(palette = "pal3"),
             pltd + scale_color_jcolors(palette = "pal3"), ncol = 2)

grid.arrange(pltl + scale_color_jcolors(palette = "pal4"),
             pltd + scale_color_jcolors(palette = "pal4") + 
                 theme(panel.background = element_rect(fill = "grey5")), ncol = 2)

grid.arrange(pltl + scale_color_jcolors(palette = "pal5"),
             pltd + scale_color_jcolors(palette = "pal5"), ncol = 2)

pltd <- ggplot(data = OrchardSprays, aes(x = rowpos, y = decrease,
group = factor(treatment),
colour = factor(treatment))) +
    geom_line(size = 2) +
    geom_point(size = 4) +
    theme_bw() +
    theme(panel.background = element_rect(fill = "grey15"),
          legend.key = element_rect(fill = "grey15"),
          panel.border = element_blank(),
          panel.grid.major = element_line(color = "grey45"),
          panel.grid.minor = element_line(color = "grey25"),
          legend.position = "bottom")


pltd + scale_color_jcolors(palette = "pal6")

Continuous Color Palettes

Display all continuous palettes

display_all_jcolors_contin()

Use with ggplot2

set.seed(42)
plt <- ggplot(data.frame(x = rnorm(10000), y = rexp(10000, 1.5)), aes(x = x, y = y)) +
      geom_hex() + coord_fixed() + theme(legend.position = "bottom")

plt2 <- plt + scale_fill_jcolors_contin("pal2", bias = 1.75) + theme_bw()
plt3 <- plt + scale_fill_jcolors_contin("pal3", reverse = TRUE, bias = 2.25) + theme_bw()
plt4 <- plt + scale_fill_jcolors_contin("pal12", reverse = TRUE, bias = 2) + theme_bw()
grid.arrange(plt2, plt3, plt4, ncol = 2)

ggplot2 themes

library(scales)

p1 <- ggplot(aes(x = carat, y = price), data = diamonds) + 
      geom_point(alpha = 0.5, size = 1, aes(color = clarity)) +
      scale_x_continuous(trans = log10_trans(), limits = c(0.2, 3),
        breaks = c(0.2, 0.5, 1, 2, 3)) + 
      scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),
        breaks = c(350, 1000, 5000, 10000, 15000)) +
      ggtitle('Price (log10) by Carat (log10) and Clarity') + 
      scale_color_jcolors("rainbow") +      
      theme_light_bg()


p2 <- ggplot(aes(x = carat, y = price), data = diamonds) + 
      geom_point(alpha = 0.5, size = 1, aes(color = cut)) +
      scale_x_continuous(trans = log10_trans(), limits = c(0.2, 3),
        breaks = c(0.2, 0.5, 1, 2, 3)) + 
      scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),
        breaks = c(350, 1000, 5000, 10000, 15000)) +
      ggtitle('Price (log10) by Carat (log10) and Cut') + 
      scale_color_jcolors("pal4") +  
      theme_light_bg()

grid.arrange(p1, p2, ncol = 2)

p1 <- ggplot(aes(x = clarity, y = price), data = diamonds) + 
      geom_point(alpha = 0.25, size = 1, position = "jitter", aes(color = log(carat + 1))) +
      scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),
        breaks = c(350, 1000, 5000, 10000, 15000)) +
      ggtitle('Price (log10) by Carat (log10) and Clarity')
        
p2 <- ggplot(aes(x = clarity, y = price), data = diamonds) + 
      geom_point(alpha = 0.25, size = 1, position = "jitter", aes(color = log(carat + 1))) +
      scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),
        breaks = c(350, 1000, 5000, 10000, 15000)) +
      ggtitle('Price (log10) by Carat (log10) and Clarity')

grid.arrange(p1 + scale_color_jcolors_contin("pal3", bias = 1.75) + theme_light_bg(),
             p2 + scale_color_jcolors_contin("rainbow") + theme_light_bg(), ncol = 2)

If the background here were dark, then this would look nice:

grid.arrange(p1 + scale_color_jcolors_contin("pal3", bias = 1.75) + theme_dark_bg(),
             p2 + scale_color_jcolors_contin("rainbow") + theme_dark_bg(), ncol = 2)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].