You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boB Rudis 840842b286
initial commit
5 years ago
R initial commit 5 years ago
README_files/figure-gfm initial commit 5 years ago
inst/tinytest R package repo initialization complete 5 years ago
man initial commit 5 years ago
tests R package repo initialization complete 5 years ago
.Rbuildignore initial commit 5 years ago
.codecov.yml R package repo initialization complete 5 years ago
.gitignore R package repo initialization complete 5 years ago
.travis.yml R package repo initialization complete 5 years ago
CONDUCT.md R package repo initialization complete 5 years ago
DESCRIPTION initial commit 5 years ago
LICENSE initial commit 5 years ago
LICENSE.md initial commit 5 years ago
NAMESPACE initial commit 5 years ago
NEWS.md R package repo initialization complete 5 years ago
README.Rmd initial commit 5 years ago
README.md initial commit 5 years ago
ggeconodist.Rproj R package repo initialization complete 5 years ago

README.md

Travis-CI BuildStatus CoverageStatus CRAN\_Status\_Badge

ggeconodist

Create Diminutive Distribution Charts

Description

‘The Economist’ has a unique boxplot aesthetic for communicating distrribution characteristics. Tools are provided to create similar charts in ‘ggplot2’.

Inspired by: https://www.economist.com/united-states/2019/06/29/will-transparent-pricing-make-americas-health-care-cheaper

What’s Inside The Tin

  • add_econodist_legend: Helper utility to get an econodist legend into a ggplot2 plot
  • econodist_legend_grob: Create a legend grob that can be used with econodist charts
  • geom_econodist: Econodist geom / stat
  • left_align: Helper to flush ggplot2 plot components to the left
  • mammogram_costs: Cost of a mammogram in various U.S. Citites (2016, USD)
  • theme_econodist: A more current Economist-style ggplot2 theme

The following functions are implemented:

Installation

devtools::install_git("https://git.rud.is/hrbrmstr/ggeconodist.git")
# or
devtools::install_git("https://git.sr.ht/~hrbrmstr/ggeconodist")
# or
devtools::install_gitlab("hrbrmstr/ggeconodist")
# or
devtools::install_bitbucket("hrbrmstr/ggeconodist")

Usage

library(ggeconodist)

# current version
packageVersion("ggeconodist")
## [1] '0.1.0'

The whole shebang

YOU WILL NEED to install these fonts to use the built-in theme. More on how to do that at some point.

ggplot(mammogram_costs, aes(x = city)) +
  geom_econodist(
    aes(ymin = tenth, median = median, ymax = ninetieth),
    stat = "identity", show.legend = TRUE
  ) +
  scale_y_continuous(expand = c(0,0), position = "right", limits = range(0, 800)) +
  coord_flip() +
  labs(
    x = NULL, y = NULL,
    title = "Mammoscams",
    subtitle = "United States, prices for a mammogram*\nBy metro area, 2016, $",
    caption = "*For three large insurance companies\nSource: Health Care Cost Institute"
  ) +
  theme_econodist() -> gg

grid.newpage()
left_align(gg, c("subtitle", "title", "caption")) %>% 
  add_econodist_legend(econodist_legend_grob(), below = "subtitle") %>% 
  grid.draw()

ggeconodist Metrics

Lang # Files (%) LoC (%) Blank lines (%) # Lines (%)
R 10 0.91 338 0.93 68 0.75 125 0.77
Rmd 1 0.09 27 0.07 23 0.25 38 0.23

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.