Version: | 0.1.0 |
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? |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.1 |
Imports: | ggplot2, magrittr, stringr, scales, dplyr |
Suggests: | testthat |
NeedsCompilation: | no |
Packaged: | 2020-10-13 15:56:14 UTC; smlee |
Author: | Stephen Lee [aut, cre] |
Maintainer: | Stephen Lee <smlee.981@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2020-10-22 09:10:02 UTC |
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, ...)
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 |
... |
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 = ""
)