Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Coloring selected range in histogram

I’d like users to be able to select an x range from a histogram that I will use to drive another plot. However, I’d like to darken the non-selected bars to highlight the selection. I can see how to do this with a bar chart, but there doesn’t seem to be a way to set color for the actual bars (post-binning) from the histogram.

It seems that the color range / cmax / cmin attributes don’t solve the problem. I’d like a more general ability to set bar color for ranges of values, e.g., [{‘from’: 0, ‘to’: 10, ‘color’: ‘darkblue’}, {‘from’: 10, ‘to’: 20, ‘color’: ‘blue’}, {‘from’: 20, ‘to’: 30, ‘color’: ‘darkblue’}].

The only way I see to do is to use numpy.histogram() or similar and plot a bar graph. Is there an easier way?

It doesn’t seem like this is possible right now. I’ve created an issue in the plotly.js repo here to discuss and track: