Plotly Express Pie graph not assigning colours

I am trying to get a plotly express pie graph to accept some defined colours through the following code:

  colours = {'status 1': 'rgb(43, 182, 94)',      #2BB65E
                   'status 2': 'rgb(0, 143, 245)',      #008FF5
                   'status 3' : 'rgb(242,233,78)',     #F2E94E
                   'status 4' : 'rgb(205,20,28)',       #CD141C
                   'status 5' : 'rgb(255,147,2)'        #FF9302
                  }
  data['status_pie'] = px.pie(df_hire_status,
                              values ='plant_id',
                              color = 'hire_status',
                              color_discrete_map = colours,
                              names = 'hire_status'
                             )

data is passed back from the server function and populates a plot.
I have checked the string values in 'hire_status' are in fact keys of the colours dict and the code executes with out any errors but the colours do not come through on the pir graph. The same approach on a bar graph works correctly but a pie graph does not.

Any ideas?

Not sure if there has been a package update but as of this morning these colours on the above code are now correctly being assigned to the graph. Thank you who or whatever has fixed this.

2 Likes