bb_lollipop {billboarder} | R Documentation |
Helper for creating a lollipop chart
Description
Helper for creating a lollipop chart
Usage
bb_lollipop(
bb,
data,
mapping = NULL,
rotated = FALSE,
point_color = "#112446",
point_size = 8,
line_color = "#000",
...
)
Arguments
bb |
A |
data |
A |
mapping |
Mapping of variables on the chart, see |
rotated |
Switch x and y axis position. |
point_color |
Color of the lollipop. |
point_size |
Size of the lollipop. |
line_color |
Color of the lines between the axis and the lollipop. |
... |
Not used. |
Value
A billboard
htmlwidget
object.
Examples
# From wikipedia
sw <- data.frame(
film = c("The Force Awakens", "The Phantom Menace",
"Revenge of the Sith", "A New Hope",
"Attack of the Clones", "The Empire Strikes Back",
"Return of the Jedi"
),
worldwide_gross = c(2068178225, 1027044677, 848754768,
775398007, 649398328, 538375067,
475106177)
)
# Simple example
billboarder() %>%
bb_lollipop(data = sw)
# Fancy example
billboarder() %>%
bb_lollipop(data = sw, rotated = TRUE)%>%
bb_y_grid(show = TRUE) %>%
bb_y_axis(tick = list(
values = c(0, 5e+08, 1e+09, 1.5e+09, 2e+09),
outer = FALSE,
format = htmlwidgets::JS("d3.formatPrefix('$,.0', 1e6)")
)) %>%
bb_x_axis(tick = list(centered = TRUE)) %>%
bb_labs(
title = "Star Wars - Total Lifetime Grosses",
caption = "Data source : wikipedia"
)
# With mapping
billboarder(data = sw) %>%
bb_lollipop(mapping = bbaes(x = film, y = worldwide_gross))
[Package billboarder version 0.4.1 Index]