Implement discretely_colour in plotly for R

Hi All,

I am looking to create a choropleth map where the color is based on a categorical variable.

In python plotly, the discrete_colour function described here https://plotly.com/python/choropleth-maps/ exactly meets my needs.

On this stack overflow thread (https://stackoverflow.com/questions/59516054/how-to-create-a-chloropleth-map-in-r-plotly-based-on-a-categorical-variable?newreg=d5aa2dc4ff834fc7bf92254f1ed3b9da) it is mentioned in the comments that non-continuous legends for choropleths would be coming early 2020, but it is not currently available and I cannot find any related issues or release notes.

Thanks a lot in advance.

I can't seem to find a function by this name on that site.

Also note that there are several existing ways to approach a discrete cartogram in R. Probably the easiest to work with an sf object (say sf_dat), then you can do something like plot_ly(sf_dat, split = ~feature_id).

https://blog.cpsievert.me/2018/03/30/visualizing-geo-spatial-data-with-sf-and-plotly/

This won't be as performant as using the choropleth (choroplethmapbox) trace type. Off-hand I don't recall how to make discrete choropleths using these trace types, but I'm sure it's possible (you probably have to put each discrete level in it's own trace, which you can probably do via split).