Giter VIP home page Giter VIP logo

allespaletti's Introduction

allespaletti

allespaletti contains various color palettes I find useful, particularly for communication research. This includes palettes for:

  • beautiful plots both color-blind- and printer-friendly
  • political parties
  • social networking sites
  • communication associations

Installation

Install from GitHub with:

# install.packages("remotes")
remotes::install_github("joon-e/allespaletti")

Use

Load the package:

library(allespaletti)

Palettes can then be added to ggplot2 objects using custom scale_fill_xxx / scale_color_xxx functions. Add the palette name as the first argument. See below for all available palettes.

library(ggplot2)
diamonds %>% 
  ggplot(aes(x = cut, fill = cut)) +
  geom_bar() + 
  scale_fill_tol("vibrant")

Use reverse = TRUE to plot colors in reverse order or pass a vector of color names (see below) to select to create a custom order (useful for palettes with meaningful colors like political party or sns colors):

ggplot(sns_users_april_2020, aes(x = sns, y = users, fill = sns)) +
  geom_col() +
  scale_fill_sns(select = c("facebook", "youtube", "whatsapp", "instagram")) +
  labs(x = NULL, y = "Users (in millions)") +
  theme(legend.position = "none")

Palettes

Plot title shows the palette name that can be passed to the respective scale_fill_ / scale_color_ function; printed color names can be used for the select argument.

Paul Tol’s color schemes

Paul Tol developed various qualitative, sequential, and divergent color schemes that are both beautiful and distinct for most people (e.g., various forms of color-blindness) and situations (screen, print-out, black and white copy).

The following palettes are available for scale_fill_tol() / scale_color_tol():

Qualitative palettes

Diverging palettes

Use discrete = FALSE in the call to scale_fill_tol() / scale_color_tol() to use these scales for continuous data.

Sequential palettes

Use discrete = FALSE in the call to scale_fill_tol() / scale_color_tol() to use these scales for continuous data.

Politics

Palettes containing colors of political parties.

The following palettes are available for scale_fill_politics() / scale_color_politics():

German parties

US parties

Social networking sites

Palettes containing colors of social networking sites.

The following palettes are available for scale_fill_sns() / scale_color_sns():

Communication associations

Palettes containing colors of communication associations.

The following palettes are available for scale_fill_comm() / scale_color_comm():

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.