各种线图
data("revenue_wide")
line_chart(data = revenue_wide, x = year, y = Roche:Bayer) +
labs(x = "Year", y = "Revenue (Billion USD)")
biomedicalrevenue %>%
filter(year == 2018) %>%
lollipop_chart(x = company, y = revenue, threshold = 30) +
labs(
x = NULL,
y = "Revenue",
title = "Biomedical Companies with Revenue > $30Bn."
) +
scale_y_continuous(
labels = function(x) paste0("$", x, "Bn."),
expand = expansion(mult = c(0, .05))
)
data("popeurope")
dumbbell_chart(
data = popeurope,
x = country,
y1 = pop1952,
y2 = pop2007,
top_n = 10,
point_colors = c("lightgray", "#494F5C")
) +
labs(
x = NULL,
y = "Population",
title = "Europe's Largest Countries by Population in 2007"
) +
scale_y_continuous(
limits = c(0, NA),
labels = function(x) paste(x, "Mn.")
)
data(mtcars)
mtcars_z <- dplyr::transmute(
.data = mtcars,
model = row.names(mtcars),
hpz = scale(hp)
)
diverging_bar_chart(data = mtcars_z, x = model, y = hpz)
diverging_lollipop_chart(
data = mtcars_z,
x = model,
y = hpz,
lollipop_colors = c("#006400", "#b32134"),
text_color = c("#006400", "#b32134")
)
data("popch")
pyramid_chart(data = popch, x = age, y = pop, group = sex)