data %>%
plot_ly() %>%
mutate(location=as.character(location)) %>%
mutate(date = ymd(date)) %>%
filter(date == max(date)-2) %>%
filter(continent == "Europe" & location != "Russia") %>%
mutate(location = fct_reorder(location, total_cases_per_million, .desc = TRUE)) %>%
add_bars(x = ~location, y = ~total_cases_per_million, color = I("red"), opacity = 0.6,
hoverinfo = "text",
text = ~paste(location, "<br>",round(total_cases_per_million, 0), "cases per mln people")) %>%
layout(yaxis = list(title = "Total Covid-19 cases per million people", showgrid = F),
xaxis = list(title = " ")) %>%
hide_legend()