Package 'wsjplot'

Title: Style Time Series Plots Like the Wall Street Journal
Description: Easily override the default visual choices in 'ggplot2' to make your time series plots look more like the Wall Street Journal. Specific theme design choices include omitting x-axis grid lines and displaying sparse light grey y-axis grid lines. Additionally, this allows to label the y-axis scales with your units only displayed on the top-most number, while also removing the bottom most number (unless specifically overridden). The goal is visual simplicity, because who has time to waste looking at a cluttered graph?
Authors: Stephen Lee [aut, cre]
Maintainer: Stephen Lee <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2025-02-06 04:11:28 UTC
Source: https://github.com/slee981/wsjplot

Help Index


Label plots like the wall street journal i.e. display the units only on the top tick of the graph

Description

Label plots like the wall street journal i.e. display the units only on the top tick of the graph

Usage

label_wsj(
  prefix = "$",
  suffix = "",
  rm.bottom = TRUE,
  accuracy = NA,
  reverse = FALSE,
  ...
)

Arguments

prefix

character, the unit label to prefix on the max number of the y-axis

suffix

character, the unit label to append on the max number of the y-axis

rm.bottom

logical, remove the lowest number?

accuracy

double, the precision for labels e.g. 1, 0.1, or 0.01

reverse

logical, put label on the smallest tick instead of the largest?

...

args passed to scales::label_comma(...)

Examples

library(ggplot2)
`%>%` <- magrittr::`%>%`

plt <- economics_long %>%
  dplyr::filter(variable %in% c("psavert", "uempmed")) %>%
  ggplot(aes(date, value, color = variable)) +
  geom_line() +
  scale_y_continuous(
      labels = label_wsj(prefix = "$", suffix = " %")
  ) +
  theme_wsj() +
  labs(
    title = "Some Economics Plot",
    caption = "Source: Top secret."
  )

Make timeseries graphs look like the the Wall Street Journal

Description

Make timeseries graphs look like the the Wall Street Journal

Usage

theme_wsj()

Examples

library(ggplot2)
`%>%` <- magrittr::`%>%`

plt <- economics_long %>%
  dplyr::filter(variable %in% c("psavert", "uempmed")) %>%
  ggplot(aes(date, value, color = variable)) +
  geom_line() +
  scale_y_continuous(
      labels = label_wsj(suffix = " M")
  ) +
  scale_color_discrete(
      labels = c("Series 1", "Series 2")
  ) +
  theme_wsj() +
  labs(
    title = "Some Economics Plot",
    caption = "Source: Top secret.",
    y = ""
  )