question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using bokeh's Arrow to draw VectorField?

See original GitHub issue

So I found the drawing of the vectorfield arrows in the bokeh backend to be a bit awkward (mostly in looks and lack of styling options) and tried to replace it by bokeh’s Arrow through a CompositeElementPlot. Problem is (which is maybe why you didn’t do that in the first place…) that bokeh’s Figure does not expose Arrow, which is an annotation, not a marker or glyph (if I understand correctly), and hence drawing arrows in holoviews has to pass by style options, not data (again, if my understanding is correct).

Question is, do you think that could be addressed on the Holoviews side, or would one have to make a PR on the bokeh side? I briefly skimmed some related discussions on here from when you were implementing VectorField, but that’s a while ago and I couldn’t find any information on this in particular.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
philippjfrcommented, Feb 12, 2019

Here’s how to use a vectorized Arrow:

p = figure(x_range=(0, 10), y_range=(0, 10))

cds = ColumnDataSource(data=dict(x_start=[0,1, 2], y_start=[0,1, 2], x_end=[1,3, 5], y_end=[0,5, 8]))
p.add_layout(Arrow(end=OpenHead(), source=cds, x_start='x_start', y_start='y_start', x_end='x_end', y_end='y_end'))

pn.Column(p)
1reaction
badikucommented, Apr 29, 2019

like this? seems no problem:

p = figure(x_range=(0, 10), y_range=(0, 10))
cds = ColumnDataSource(data=dict(x_start=[0,1, 2], y_start=[0,1, 2], x_end=[1,3, 5], y_end=[0,5, 8], line_width=[16,5, 8], color=['red','blue','yellow']))
p.add_layout(Arrow(end=OpenHead(), source=cds, line_color='color', line_width='line_width', x_start='x_start', y_start='y_start', x_end='x_end', y_end='y_end'))
show(p)

图片

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using bokeh's Arrow to draw VectorField? #3485 - GitHub
The main problem I think is that Arrow is not vectorized in any way. That means each individual arrow would have to be...
Read more >
Plotting with basic glyphs - Bokeh documentation
To draw a simple line arc, use the arc() glyph method, which accepts radius , start_angle , and end_angle to determine position. Additionally,...
Read more >
VectorField — HoloViews v1.15.3
A VectorField plot displays velocity vectors as arrows at x and y positions with angle and magnitude components (or alternatively U , V...
Read more >
Extract renderers from holoviews to be added to custom ...
I have a class which uses Bokeh to create a custom plot. Now, I'd like to plot a vector field. Bokeh doesn't have...
Read more >
01-linear-algebra-Introduction - Refactored.ai
We will be using square brackets to represent vectors and matrices which w ... We going to plot the position of point (x,y)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found