charts
charts.Rmd
Bar Chart
Create bar charts with v_bar()
:
electricity_mix %>%
subset(country %in% c("France", "South Korea")) %>%
vchart() %>%
v_bar(aes(country, generation, fill = source)) %>%
v_scale_color_manual(c(
"oil" = "#80549f",
"coal" = "#a68832",
"solar" = "#d66b0d",
"gas" = "#f20809",
"wind" = "#72cbb7",
"hydro" = "#2672b0",
"nuclear" = "#e4a701"
))
Line Chart
Create line charts with v_line()
:
Area Chart
Create area charts with v_area()
:
vchart(eco2mix_long) %>%
v_area(aes(date, production, fill = source), stack = TRUE) %>%
v_scale_y_continuous(min = -2000)
Create area range charts with v_area()
and providing
ymin
and ymax
aesthetics:
Pie Chart
Create pie or donut charts with v_pie()
:
Histogram Chart
Create histograms with v_hist()
:
Scatter Chart
Create scatter charts with v_scatter()
:
Smooth Chart
Create smooth charts with v_smooth()
:
Boxplot
Create boxplots with `v_boxplot()
:
Jittered points
Create jittered points chart with v_jitter()
:
Heatmap
Create heatmaps with v_heatmap()
:
Treemap
Create treemaps with v_treemap()
:
Circlepacking
Create circlepacking charts with v_circlepacking()
:
vchart(countries_gdp) %>%
v_circlepacking(
aes(lvl1 = REGION_UN, lvl2 = SUBREGION, lvl3 = ADMIN, value = GDP_MD)
)
Sankey Chart
Create sankey charts with v_sankey()
:
WordCloud
Create wordclouds with v_wordcloud()
:
vchart(top_cran_downloads) %>%
v_wordcloud(aes(word = package, count = count, color = package))
Waterfall Chart
Create waterfall charts with v_waterfall
:
data.frame(
desc = c("Starting Cash",
"Sales", "Refunds", "Payouts", "Court Losses",
"Court Wins", "Contracts", "End Cash"),
amount = c(2000, 3400, -1100, -100, -6600, 3800, 1400, 2800)
) %>%
vchart() %>%
v_waterfall(aes(x = desc, y = amount))