# NOT RUN {
library(dplyr)
plot_data <- ggplot2::diamonds %>%
mutate(cut = stringr::str_to_sentence(cut)) %>%
group_by(cut) %>%
summarise(average_price = mean(price)) %>%
mutate(average_price_thousands = round(average_price / 1000, 1))
plot <- ggplot_hbar(data = plot_data, x_var = average_price_thousands, y_var = cut,
title = "Average diamond price by cut",
x_title = "Average price ($US thousands)",
y_title = "Cut")
plot
plotly::ggplotly(plot)
# }
Run the code above in your browser using DataLab