Comments (7)
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.
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.
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.
line_dash=[5, 5]
works withline
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.
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.
Alternatively one can also use this:
plot.hspan(y=0, line_dash=[[5, 5]])
from bokeh.
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)
- Add IndexedStackColorMapper for ImageStack glyph
- [BUG] `bokeh.plotting.figure.circle` does not display circles in bokeh 3.4.1 HOT 6
- Release build fails after PR #13901 HOT 2
- [BUG] ColumnDataSource serialization failed for `int` Masked array with `ValueError` / `TypeError` HOT 2
- [FEATURE] triangle relative size by data units HOT 1
- [BUG] Figure not displaying in Dash app (sad smiley) when width >= 20000 HOT 1
- 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
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.