knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  fig.align = "center",
  out.width = "50%"
)

wspviz

Utilities for common R visualization tasks at WSP Finland. Current features:

Planned features:

Installation

Ensure 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).

Functions currently

Examples

Get 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"))

Contributing

If you have any ideas or questions, feel free to submit an issue or even make a pull request!

Author

Arttu Kosonen (datarttu), arttu (dot) kosonen (at) wsp (dot) com



webbidevaajat/wspviz documentation built on Nov. 5, 2019, 12:07 p.m.