Coder Social home page Coder Social logo

Comments (3)

ianthomas23 avatar ianthomas23 commented on July 18, 2024 1

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.

bryevdv avatar bryevdv commented on July 18, 2024 1

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.

bryevdv avatar bryevdv commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.