Comments (3)
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.
from bokeh.
Actually, updating the ticker object itself does not really seem to do the right thing in either case, at least on branch-3.5
But it's also not what I would advise in any case. Best practice in Bokeh is to update properties of existing objects, rather than create entire new objects (like a brand newFixedTicker
). I would actually have advised writing this code:
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)
from bokeh.
Note how much code I wrote to update the colorbar.
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 accepts
clauses to the properties than that could probably be reduced to
colorbar.update(levels=levels, ticker=levels)
If even more simplification is desired, perhaps some new one-line convenience method colorbar.set_levels()
could be added. But update
is a completely generic method on the lowest base class that has a single responsibility to update individual property values, and nothing else (analogous to dict.update
) We should definitely not do anything to "teach" update
about any particular classes or override it to do different things on different classes.
from bokeh.
Related Issues (20)
- Tests/CI fail due to a regression in requests 2.32.0
- [BUG] Dialog and Datatable don't get along well HOT 4
- [BUG] Databable cannot be put in Dialog HOT 2
- [BUG] Bokeh 3.5 no longer allow custom properties for HTMLAttr HOT 1
- [FEATURE] Attach ScaleBar to subplot range
- `Tooltip.content` doesn't rebuild views on change
- UI gesture detection fails in interactive tests in FireFox HOT 1
- [BUG] When I want to insert a picture into the bokeh icon and save it as an HTML file, I get a white screen when I open it. Why? HOT 5
- [BUG] DataTable update fails when selected indices don't exist in new data
- Explore using `pytest-mypy-plugin` for type-related tests
- `Model.js_on_change` needs better validation of inputs
- Investigate using `Object.preventExtensions()` on model instances HOT 1
- [FEATURE] Allow extensions to register server side events
- `AjaxDataSource.if_modified` not implemented
- Search doesn't work on docs.bokeh.org HOT 3
- VTable integrate with bokeh HOT 2
- Bokeh documentation is not showing up on Bing and DuckDuckGo HOT 3
- [BUG] RangeTool `start_gesture` values besides `none` prevent notebook rendering HOT 5
- TextInput loses focus when callback on value_input is triggered[BUG]
- Version banner warns about unknown version on latest docs after 3.4.2 release
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bokeh.