Choropleth and categories instead of z-value

As I understand, Choropleth are colored in proportion to the measurement of the statistical variable being displayed on the map; as such, there is a z-value which must be a number.

But what if I aim to highlight countries depending of the category they are included in? For instance, what if I had a range slider from 1990 to 2019, and depending on the picked year, the Choropleth displays the Europe 12 (1993), Europe 15 (1995), 25, 27,28 etc ?

A workaround would be to define a category-number, but then Choropleth displays the Z-value of each category, instead of the name of the category.

Is there another solution for this?

I found a solution;

  1. Define one category as a number, for each group of countries
  2. set hoverinfo=‘location+text’

This way the z-value (category code) is not displayed anymore.