How to fix "No scattergeo mode specifed: Setting the mode to markers" error message?

Viewed 120

I am working on the following code

athletes %>%
  rename(sport = Discipline) %>%
  group_by(country) %>%
  summarize(number_of_athletes = n()) %>%
  mutate(hover = paste0(country,"\n","Number of Athletes: ", number_of_athletes)) %>%
  plot_geo(type = "choropleth") %>%
  add_trace(locations = ~country, 
            locationmode = "country names", 
            z = ~number_of_athletes,
            colorscale = "Portland",
            text = ~hover, 
            hoverinfo = "text",
            marker = list(line = list(color = "gray50"))) %>%
  layout(title = list(text = "Number of Athletes by Country", font = list(size = 20), xanchor = "center", yanchor = "middle"), 
         width = 900,
         height = 500, 
         margin = list(b = 10),
         dragmode = FALSE, 
         showlegend = TRUE) %>%
  colorbar(title = "Number of Athletes") %>%
  config(displayModeBar = FALSE)

I receive: No scattergeo mode specifed: Setting the mode to markers / Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode

I tried to fix using type = 'scatter', mode = 'markers' the message still appears. Any idea?

0 Answers
Related