Description Usage Format References Examples
Cost of the Children's Health Insurance Program (CHIP) for five years compared to the costs of major provisions in the 2017 US tax bill. Note that the latter costs are calculated over 10 years, not over five. The data were obtained from an article in VOX (see References).
1 |
An object of class data.frame
with 4 rows and 4 columns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | library(ggforce)
library(dplyr)
chip_df <- mutate(CHIP_tax,
r = 2*sqrt(amount)/sqrt(max(amount)),
x = c(0.1, 3, 5.5, 5.8),
y = c(0.2, 2, 4, 2.2))
amount_df <- mutate(chip_df,
label = c("$8 billion", "$1.3 trillion", "$415\nbillion", "$83 \nbillion"),
xa = x + r * c(1.5, 0, 0, 0),
ya = y + r * c(0, -.1, -.25, 0),
size = c(18, 24, 18, 18)/.pt,
hjust = c(0, 0.5, 0.5, 0.5))
purpose_df <- mutate(amount_df,
label = c("Extend CHIP\nfor five years", "Cut the corporate tax\nrate to 21 percent",
"Cut pass-through\nbusiness taxes", "Roll back\nestate tax"),
xp = x - r * c(1, 0, 0, 0),
yp = y + r * c(3, .2, .3, -1.6))
ggplot(chip_df, aes(x0 = x, y0 = y, r = r, fill = color)) +
geom_circle(color = NA) +
geom_text(data = amount_df,
aes(label = label, x = xa, y = ya, hjust = hjust, size = size),
inherit.aes = FALSE, fontface = "bold", lineheight = 1) +
geom_text(data = purpose_df,
aes(label = label, x = xp, y = yp, hjust = hjust),
inherit.aes = FALSE, fontface = "plain", lineheight = 1,
size = 16/.pt) +
scale_fill_identity() +
scale_size_identity() +
coord_fixed() +
theme_void()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.