knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", fig.align = "center", out.width = "50%" )
Utilities for common R visualization tasks at WSP Finland. Current features:
Planned features:
ggplot2
themes for WSP and other common contextsEnsure you have devtools
installed.
To get the latest development version of wspviz
,
run the following command:
devtools::install_github("webbidevaajat/wspviz")
Current version depends on ggplot2
library
(because of show_palettes()
function).
pal_wsp()
: standard WSP colorspal_wsp2()
: strong WSP colors + some ad-hoc accent colors,
meant for visualizations where several distinct colors are neededpal_hsl()
: color palette defined by Helsinki Region Transport style guideGet all the HSL colors as a named vector:
library(wspviz) pal_hsl()
Get selected WSP colors:
library(wspviz) pal_wsp("red", "blue", "gray")
Plot a color palette:
library(wspviz) show_palette(pal_wsp())
NEW: a palette with basic WSP colors + a couple of roughly matching accent colors:
library(wspviz) show_palette(pal_wsp2())
If you are for some reason running the palette functions several times, say, generating 1000 different plots, you can extract the color codes and just use named vector subsetting for a slight performance benefit (comparison has not been made so far), like this:
library(wspviz) pal <- pal_hsl() show_palette(pal[c("bus", "tram", "train", "metro", "ferry")]) # Instead of show_palette(pal_wsp("purple", "midnightblue"))
If you have any ideas or questions, feel free to submit an issue or even make a pull request!
Arttu Kosonen (datarttu), arttu (dot) kosonen (at) wsp (dot) com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.