Reset color bar values after applying shading for time series histogram plots

The tf.shade function is handy for visualizing the density/frequency of sample values across time points for time series plots. However, after applying shading, the color bar values are rescaled to extraordinary magnitude (i.e. 1e9), see this example.

I’m assuming the rescaled values are necessary for plotting purposes, as when I manually reset them to the frequency counts (prior to being passed to tf.shade), the shading in the plot wouldn’t do it justice. But is there a way to get the frequency counts, instead of rescaled values, populated in the color bar? It’ll be a lot more intuitive that way I think.


1 Like

It looks like you’re using tf.shade but then embedding the result in a Matplotlib plot? I didn’t try to follow the details in that library, but after tf.shade, the colorbar won’t be meaningful, because tf.shade returns RGBA pixels, not array values. I’d suggest following the approach in Interactivity — Datashader 0.13.0 documentation, which shows how to use Datashader’s new matplotlib support, including support for Datashader’s nonlinear eq_hist colormapping (but applied within matplotlib).

1 Like