Highcharter is one of the best interactive visualization package available in R. Barplots are the most commonly used plots in the data visualization world.
Highcharter is a R wrapper for Highcharts javascript library and its modules. Highcharts is very flexible and customizable javascript charting library and it has a great and powerful API.
We are going to use this dataset for plotting different variations of the barplots
mpg %>%
group_by(manufacturer) %>%
count() %>%
arrange(desc(n)) -> makers
hchart(
makers,
"column",
hcaes(x=manufacturer, y= n),
color = "maroon"
)
mpgman2 <- count(mpg, manufacturer, year)
hchart(
mpgman2,
"bar",
hcaes(x = manufacturer, y = n, group = year),
color = c("maroon", "darkgrey"),
name = c("Year 1999", "Year 2008")
)
mpgman2 <- count(mpg, manufacturer, year)
hchart(
mpgman2,
"column",
hcaes(x = manufacturer, y = n, group = year),
color = c("maroon", "darkgrey"),
name = c("Year 1999", "Year 2008")
)
mpg %>%
group_by(manufacturer, year) %>%
count() %>%
arrange(desc(manufacturer)) -> makers
hchart(
makers,
"column",
hcaes(x = manufacturer, y = n, group = year),
color = c("maroon", "darkgrey"),
name = c("Year 1999", "Year 2008")
)
mpgman2 <- count(mpg, manufacturer, year)
hchart(
mpgman2,
"column",
hcaes(x = manufacturer, y = n, group = year),
color = c("maroon", "darkgrey"),
name = c("Year 1999", "Year 2008"),
stacking = "normal"
)