Legend bug going between continuous and discrete coloring

I generate a new figure for my plots depending on a radio button selection. One of the options shows a discretely colored plot that I set in the figure with color_discrete_map={‘Yes’: ‘#EFF814’, ‘No’: ‘#13078A’}.

When I switch to one of my continuous colored map options (e.g. color_continuous_scale=‘Hot_R’) and then back to my discrete map selection, the coloring is showing the gradient from the previous plot.

This only happens in the case where the map is only plotting 1 discrete value, so all “Yes” or all "No. If both “Yes” and “No” values are present in one of the maps then the coloring gets set correctly. When you download the graph it actually downloads with the legend colored correctly, it just isn’t displaying it right in the browser.

The figures are generated by different functions. I have tried setting fig to None before generating. I don’t know if there is some better way to “clear” the figure first or specify the discrete coloring if there’s only 1 value showing. It works fine if I have not yet plotted a continuous scale plot.

Any help would be much appreciated!