medal_counts2 | R Documentation |
Medal Counts for Winter Olympics by Country
A dataset containing the medals and places won by each country, assuming the country has won at least 1 total medal
medal_counts2
A data frame with 117 rows and 3 variables:
name of country, as referred to by the USA
type of medal, factor with levels "gold", "silver" or "bronze"
number of medals of that type, in counts
utils::data(medal_counts2) medal_counts2 |> dplyr::mutate(Medal = forcats::fct_relevel(Medal,'bronze','silver','gold'), Country = reorder(Country, totals, sum)) |> plotly::plot_ly() |> plotly::add_bars(x = ~Country, y = ~totals, color = ~Medal, colors = c("#CD7F32", "#C0C0C0", "#FFD700")) |> plotly::layout(hovermode = "x") |> plotly::layout(title = "Norway Has the Most Gold, Silver, <br> and Bronze Winter Olympic Medals <br> (1924 - 2014)") |> plotly::layout( yaxis = list(title = "Total Medals"), xaxis = list(rangeslider = list(type = "date")), updatemenus = list(list(type = "buttons", direction = "right", x = 0.9, y = 0.98, buttons = list( list(method = "relayout", args = list("barmode", "group"), label = "Dodge"), list(method = "relayout", args = list("barmode", "stack"), label = "Stack") ))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.