Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Scale points in scatter mapbox and choose colors

Hello,

I have just started using plotly and it is working great but I cannot figure out how to do two things.

  1. I need to pick the colors of my split. Currently, I am splitting by Territory and plotly doesn’t allow me to code what colors I want each territory to be.
  2. I also need to scale the points so that some markers are very large. I tried creating a size for each row and setting size = ~size and sizes = c(2, 100) but this did not work.

Any advice on how to do this? I’ve pasted my code without the size or color attempt because i could never get it to work.

p <- df %>%
  plot_mapbox(lat = ~lat, lon = ~lon,
              split = ~Territory, 
              mode = 'scattermapbox',
              text = df$text,
              hoverinfo = "text"
              ) %>%
  layout(title = 'Ship to Zip Codes',
         font = list(color='white'),
         plot_bgcolor = '#191A1A', paper_bgcolor = '#191A1A',
         mapbox = list(style = 'dark'),
         legend = list(orientation = 'h',
                       font = list(size = 8)),
         margin = list(l = 25, r = 25,
                       b = 25, t = 25,
                       pad = 2))