Coder Social home page Coder Social logo

Comments (7)

mattpap avatar mattpap commented on July 1, 2024

plot.hspan(y=0, line_dash=[5, 5])

line_dash=[5, 5] is interpreted in this context as two data points with line_dash=5, which on its own doesn't make sense and lack of proper validation of scalar/vector properties allows this to be propagated to bokehjs. The best way to deal with array scalars is to use the following syntax:

from bokeh.core.properties import value
plot.hspan(y=0, line_dash=value([5, 5]))

This way no interpretation will be performed and the resulting plot will work as expected.

from bokeh.

bryevdv avatar bryevdv commented on July 1, 2024

Is this something specific to hspan? Or a new development? I am nearly 100% certain that line_dash=[5, 5] has worked in other contexts in the past.

from bokeh.

huaracheguarache avatar huaracheguarache commented on July 1, 2024

line_dash=[5, 5] works with line, which is why I found it curious that it didn't work with hspan. It also doesn't work with vspan when I checked just now. @mattpap's suggested workaround fixes the issue for hspan and vspan.

from bokeh.

mattpap avatar mattpap commented on July 1, 2024

line_dash=[5, 5] works with line

This works, because Line glyph uses scalar visual properties, i.e. you provide a single value for all data points, thus an array is interpreted as a value. HSpan and VSpan glyphs, however, use vectorized visual properties and thus the interpretation is different.

from bokeh.

mattpap avatar mattpap commented on July 1, 2024

Is this something specific to hspan? Or a new development? I am nearly 100% certain that line_dash=[5, 5] has worked in other contexts in the past.

It always worked like this. Another similar prominent case is Figure.image_rgba(image=[img]) (or image=value(img)). As mentioned in my previous comment, the difference for line_dash comes from the difference in behavior between scalar and vector visual properties.

from bokeh.

mattpap avatar mattpap commented on July 1, 2024

Alternatively one can also use this:

plot.hspan(y=0, line_dash=[[5, 5]])

from bokeh.

bryevdv avatar bryevdv commented on July 1, 2024

I think this can be made to meet expectations, so I would suggest we triage as a bug. For specialized line-dash properties I think it would acceptable for a vector spec to inspect the entire given value to see whether it is a flat list, or a nested list, and act accordingly.

Edit: IIRC the original concern with image glyphs was the cost of inspecting potentially large data structures in the ragged array case, but now that we no longer accept ragged arrays as input maybe the image case could be similarly improved (but that deserves a separate issue)

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.