# NOT RUN {
data(biomedicalrevenue)
revenue2018 <- biomedicalrevenue[biomedicalrevenue$year == 2018, ]
revenue_roche <- biomedicalrevenue[biomedicalrevenue$company == "Roche", ]
## By default bar_chart() creates a horizontal and sorted plot
bar_chart(revenue2018, company, revenue)
## If the `y` argument is missing the count of each value in `x` is displayed
bar_chart(mtcars, cyl)
## Create a vertical, non-sorted bar chart
bar_chart(revenue_roche, year, revenue, horizontal = FALSE, sort = FALSE)
## column_chart() is a shortcut for the above
column_chart(revenue_roche, year, revenue)
## Limit the number of bars to the top 10
bar_chart(revenue2018, company, revenue, top_n = 10)
## Display only companies with revenue > 40B.
bar_chart(revenue2018, company, revenue, threshold = 40)
## Change the bar color
bar_chart(revenue2018, company, revenue, bar_color = "purple")
## Highlight a single bar
bar_chart(revenue2018, company, revenue, top_n = 10, highlight = "Roche")
## Use facets to show the top 10 companies over the years
bar_chart(biomedicalrevenue, company, revenue, facet = year, top_n = 10)
# }
Run the code above in your browser using DataLab