New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] ContourColorBar update is incomplete #13841
Comments
The contouring in Bokeh is just the start of an implementation and lots of improvements need to be added. Some possible improvements are listed at #12234, this is another one. |
FYI you wrote more code than is necessary, as there is no need to update the renderers at all. All that is needed is to update the levels and the ticker: colorbar.update(
levels=list(levels),
ticker=FixedTicker(ticks=list(levels))
) which, to be honest, does not seem like an onerous amount of code to me. If we added colorbar.update(levels=levels, ticker=levels) If even more simplification is desired, perhaps some new one-line convenience method |
Actually, updating the ticker object itself does not really seem to do the right thing in either case, at least on colorbar.levels = list(levels)
colorbar.ticker.ticks = list(levels) which does update the axis ticks as expected. The same potential conveniences above (and maybe others) could still make sense. @ianthomas23 the extra space created on the top though when the ticks update, that does seem like an actual bug, do you think we should split this issue? (@Davide-sd for future ref please try to keep issues focused to single things, and especially have distinct issues for features vs bugs. This issue seemed like just a feature request at first glance, and we will definitely need to track work separately) |
Software versions
Python version: 3.10.12
Bokeh: 3.4.1
Browser name and version
No response
Jupyter notebook / Jupyter Lab version
No response
Expected behavior
I expect the colorbar to always provide correct information.
Note how much code I wrote to update the colorbar. In an ideal world, I would like
ContourRenderer
to automatically update any colorbar associated to it. This would probably requireContourRenderer.construct_color_bar()
to store the colorbar somewhere.Also, note that I had to write
levels=list(levels)
insidecolorbar.update
. Would it be possible to get Bokeh do the casting when I provide a 1D numpy array? After all, when I createdcontour_renderer
, the casting was managed by Bokeh...Observed behavior
I'm trying to update a contour plot and I expect the colorbar to display correct information. Instead, as I move the sliders, the colorbar's filled colors shrinks and the tick labels don't get updated. This behavior is visible in the screenshot.
Example code
Stack traceback or browser console output
No response
Screenshots
The text was updated successfully, but these errors were encountered: