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
|
5 years ago | |
---|---|---|
R | 5 years ago | |
README_files/figure-gfm | 5 years ago | |
inst/tinytest | 5 years ago | |
man | 5 years ago | |
tests | 5 years ago | |
.Rbuildignore | 5 years ago | |
.codecov.yml | 5 years ago | |
.gitignore | 5 years ago | |
.travis.yml | 5 years ago | |
CONDUCT.md | 5 years ago | |
DESCRIPTION | 5 years ago | |
LICENSE | 5 years ago | |
LICENSE.md | 5 years ago | |
NAMESPACE | 5 years ago | |
NEWS.md | 5 years ago | |
README.Rmd | 5 years ago | |
README.md | 5 years ago | |
ggeconodist.Rproj | 5 years ago |
README.md
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 ploteconodist_legend_grob
: Create a legend grob that can be used with econodist chartsgeom_econodist
: Econodist geom / statleft_align
: Helper to flush ggplot2 plot components to the leftmammogram_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.