Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposing a Bokeh Draw tool #6370

Closed
caffeine-potent opened this Issue Jun 1, 2017 · 24 comments

Comments

Projects
None yet
8 participants
@caffeine-potent
Copy link

caffeine-potent commented Jun 1, 2017

Code would work like this

ds = ColumnDataSource({'x': [], 'y': []})  
tool = DrawTool(source = ds, x = "x", y = 'y') 
my_plot.add_tools(tool)  

The draw tool draws points on your plot. A column data source of your choice is updated with the position of these dots. The point placement/min-resolution is dependent on your zoom level.

An example that can be used in the documentation would be drawing points and fitting lines/curves to those points.

Does anyone here have the patience to walk me through the development of this tool? I would like to start contributing other tools in the future.

@bryevdv

This comment has been minimized.

Copy link
Member

bryevdv commented Jun 2, 2017

@jlstevens

This comment has been minimized.

Copy link
Contributor

jlstevens commented Jun 2, 2017

@caffeine-potent Definitely sounds very similar to a tool we are currently working on. @philippjfr from the description, do you think this fits into our plans for editing related tools?

@philippjfr

This comment has been minimized.

Copy link
Contributor

philippjfr commented Jun 6, 2017

Yes, we're building a tool just like that, which will be part of a bigger suite of drawing and editing tools. Our DrawTool will probably be slightly more general letting us draw both points and lines. We'll make sure to keep you updated on our progress.

@caffeine-potent

This comment has been minimized.

Copy link
Author

caffeine-potent commented Jun 7, 2017

@philippjfr
Thanks for the response.
Do you have any notes on your plans for the drawing or editing tools?

@jlstevens

This comment has been minimized.

Copy link
Contributor

jlstevens commented Jun 8, 2017

@caffeine-potent The general plan is to write a number of tools that are broken up along two axes: a specification of what you are editing and then the type of action (insert, draw, move vertex etc). Then we have a plan to group these tools together into more powerful and general tools that merge the individual functionalities together.

@caffeine-potent

This comment has been minimized.

Copy link
Author

caffeine-potent commented Jun 9, 2017

@jlstevens
Thanks for the response! I'm really looking forward to this!

As for this issue. I'm not certain yet about GIT etiquette yet. Should this remain an open issue until the feature in question is released?

@bryevdv

This comment has been minimized.

Copy link
Member

bryevdv commented Jun 9, 2017

Yes I think so, @jlstevens @philippjfr maybe a wiki page working document to discuss an outline requirements would be good?

FYI @caffeine-potent just to set expectations, both Bokeh and HV are in the middle of getting releases out next week so there probably won't be much activity (even discussion) until after then.

@jlstevens

This comment has been minimized.

Copy link
Contributor

jlstevens commented Jun 9, 2017

Yes I think so, @jlstevens @philippjfr maybe a wiki page working document to discuss an outline requirements would be good?

Good idea!

FYI @caffeine-potent just to set expectations, both Bokeh and HV are in the middle of getting releases out next week so there probably won't be much activity (even discussion) until after then.

I do hope to have a rough prototype to show before then, even with the HoloViews release to work on. I'll keep you updated!

@LinuxChristian

This comment has been minimized.

Copy link
Contributor

LinuxChristian commented Aug 1, 2017

Hi Guys,

I am also working on a project where this feature would be great.
Do you have a rough estimate of when you might release this? And perhaps a link to the wiki page?

@jlstevens

This comment has been minimized.

Copy link
Contributor

jlstevens commented Aug 7, 2017

@LinuxChristian

We recently completed a prototype of one of these tools and we should now be able to make rapid progress on the remaining draw/edit functionality. It should be available for testing in a PR soon - hold on a little longer and you'll be able to try it out!

@busino

This comment has been minimized.

Copy link
Contributor

busino commented Aug 7, 2017

That sounds perfect.

I have a project where I plan to use bokeh to draw on a photo-image.
The end-user should be able to mark POIs (Points of interest) with a circle-glyph.
The functionality should be insert, drag and delete these points.
Drawing a line and dragging the end-points would be great too.

I'm looking forward to test or contribute to this feature.

@LinuxChristian

This comment has been minimized.

Copy link
Contributor

LinuxChristian commented Aug 8, 2017

That sounds great! I ended up hacking together a quick polygon creation and editing tool through the powerful CustomJS functionality but would prefer a build in solution. Looking forward to testing it.

@ShivaSmith

This comment has been minimized.

Copy link

ShivaSmith commented Sep 2, 2017

Hi.. any updates on the DrawTool? To be able to click and drag: points, lines, rect's, poly's would be super useful!! I'd be happy to help test. Thanks!

@philippjfr

This comment has been minimized.

Copy link
Contributor

philippjfr commented Sep 2, 2017

Here are demos of my current prototypes. I hope to meet @bryevdv next week to figure out if and how we can get them into bokeh and discuss how to improve them. There's still quite a bit of iteration on the UI and various features to do.

@ShivaSmith

This comment has been minimized.

Copy link

ShivaSmith commented Sep 2, 2017

Thanks very much for posting your demos! I'll definitely check them out.

Glad to see progress continuing on these vital features! It will be really great to see them integrated into Bokeh.

@ShivaSmith

This comment has been minimized.

Copy link

ShivaSmith commented Sep 2, 2017

Hi @philippjfr, when I run your notebook I'm seeing:

----> 7 from earthsim.tools import (attach_vertex_editing, CDSStream, save_shapefile,
      8                             attach_box_drawing, attach_point_add, attach_poly_drawing)
      9 

ModuleNotFoundError: No module named 'earthsim'

I searched everywhere I could think of for earthsim (GitHub, Google, pypi, etc.) but couldn't seem to find it. I think I have all the other packages your notebook references installed ok.

I found a reference to EarthSim here -- conda/conda#5867
it references: https://github.com/ContinuumIO/EarthSim/issues/80

But https://github.com/ContinuumIO/EarthSim no longer exists... ;) :).

Can I get it from somewhere? :)... Thanks!

@busino

This comment has been minimized.

Copy link
Contributor

busino commented Sep 2, 2017

@philippjfr

Thanks for sharing your example.

Would be great to get access to the sourcecode of the magical EarthSim package.

@bryevdv

This comment has been minimized.

Copy link
Member

bryevdv commented Sep 2, 2017

Unfortunately EarthSim is client work, we are unable to share it.

@philippjfr

This comment has been minimized.

Copy link
Contributor

philippjfr commented Sep 2, 2017

Right, for now I can't share it, in future EarthSim will be open-source, but all the tools work should migrate out of there to some upstream package anyway.

@busino

This comment has been minimized.

Copy link
Contributor

busino commented Sep 2, 2017

Hmmm...

What are the plans?
When can we expect to get something (in a release or sample code)?

For me it would be great to get some example code as a starting point for implementing a DrawTool.

My deadline is end of this year to have a working Web-DrawTool.
I'm really interested in using or implementing it with bokeh and not with other js/canvas toolkits.

In my case I only have points and lines (defined by 2 points).

If you have a look what google-maps is providing for geometry generation:

  • Marker
    • Point Glyph
  • Draw a line
    • Line (2Points)
    • Line Multiple Points
    • Polygon (Multiple Points, Closed)

For the User-Interaction it would be great to have simple drag and drop possibilities for the given points.

My suggestion is to have a Edit-Mode that enables inserting, editing and deleting geometry items.

Edit-Mode

Create

OnClick create point
OnDoubleClick finish creation
OnClick on start-point create a polygon

Edit

Markers/Points/Line-Points are highlighted when hovering.
On Click-Down the point can be moved.
On Click-Up the Point is placed on the new position.

Lines are highlighted when hovering
On Click-Down the whole line/polygon can be moved.
On Click-Up the Point is placed on the new position.

Delete

Select Geometry OnClick
Press Delete geometry is deleted

Delete of sub-entities (points, lines) of a geometry is not clear to me.

Thanks for your feedback.

@philippjfr philippjfr referenced this issue Nov 1, 2017

Merged

Add support for multi-gesture tools #7149

1 of 2 tasks complete
@busino

This comment has been minimized.

Copy link
Contributor

busino commented Nov 9, 2017

@philippjfr

What is the best way to start implementing a Point Editor like this:
http://mpld3.github.io/examples/drag_points.html

  • Drag Points
    • Insert New Points
    • Delete Points
      Do you have some code snippets around that you can share?

What about #7149, is there some example code around?

Would be great to get some Kick-Off-Code.

@busino

This comment has been minimized.

Copy link
Contributor

busino commented Nov 9, 2017

Hui,
I have a small example setup:
Notebook: https://gist.github.com/busino/649924470274059094064b2ccef97faf
Script: https://gist.github.com/busino/7f59c8c03e13c62983090722dc5de40e
It's a little bit hacky.
I would prefer to have the possibility to hover a point and drag without clicking the point for selection and click again for release.
Any hints are welcome how to improve such a Labeling-App, Yes it's used to identify frog individuals....

@philippjfr philippjfr referenced this issue Jan 15, 2018

Merged

Add drawing tools #7415

7 of 7 tasks complete
@philippjfr

This comment has been minimized.

Copy link
Contributor

philippjfr commented Jan 19, 2018

#7415 adds an initial set of drawing/editing tools along with some documentation on how to use them. The current tools include:

  • BoxDrawTool: Allows drawing, dragging and deleting Rect glyphs on one or more renderers

  • PointDrawTool: Allows adding, dragging and deleting point-like glyphs (of XYGlyph type) on one or more renderers

  • PolyDrawTool: Allows drawing, selecting and deleting Patches and MultiLine glyphs on one or more

  • VertexEditTool: Allows editing the vertices of one or more Patches or MultiLine glyphs and if enabled allows dragging and deleting entire lines or polygons.

If anyone has got some time to test these or have suggestions about naming, UI or API that would be very helpful. We're hoping to merge these asap.

@bryevdv

This comment has been minimized.

Copy link
Member

bryevdv commented Jan 26, 2018

Im going to go ahead and close this by #7415 Any future work should go in separate focused issues.

@bryevdv bryevdv closed this Jan 26, 2018

@bryevdv bryevdv added this to the 0.12.14 milestone Jan 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.