-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Arrow elements should support arrows in any direction #34
Comments
This won't be implemented in time 1.1 but it is worth mentioning this is already possible by defining a def add_arrow(plot, element):
axis = plot.handles['axis']
axis.annotate("", xy=(1.2, 1.2), xycoords='data',
xytext=(1.8, 1.8), textcoords='data',
arrowprops=dict(arrowstyle="->", color='k',
connectionstyle="arc3")) This code gets the axis from the plot.handles and then adds the custom Arrow annotation. You can then apply this function as follows: %%opts Curve [finalize_hooks=[add_arrow]]
Curve(zip([0,1,2], [1,2,3])) Or of course via the call method: Curve(zip([0,1,2], [1,2,3]))(style={'finalize_hooks': [add_arrow]}) |
It should be noted that:
|
Looking at the current |
I agree that Adding Perhaps you are suggesting making |
Yes at the very least it should be a style option. If we are keeping it as a style or plot option I'd at least want there to be a rough equivalence between the accepted arrowstyles across backends. It definitely should not be on the Element itself however. |
I'm not entirely convinced. As an annotation, what the thing looks like is part of the definition (unlike our other elements). Repeating an arrowstyle over and over again for a particular arrow seems like it would be a giant pain to me. |
So then you're arguing that all backends need to support all the arrowstyles that are defined on the Element? I don't think that's practical. |
No. I am arguing they should support whatever arrowstyles they can. If they have to fall back to a single arrow style (or a similar one that might not quite be identical) then so be it. Edit: I would say the backend should just warn that a particular arrow style that has been requested is not supported. All backends will likely support the same simple arrow heads. |
Okay, not a huge fan because we're letting matplotlib determine what's a valid arrowstyle but I'm happy to leave it. Just have to decide what to do about direction now, the only general solution is letting you define the start and end point of your arrow. So perhaps add a parameter that defines the starting position, which is None by default and overrides the direction if set. |
Sounds reasonable to me.
This is true for many things already. Matplotlib is what people will be familiar with and we already have utilities for Bokeh that convert from existing matplotlib concepts. We want to keep the API as consistent across backend and matplotlib is our basic, best supported (and first!) backend. As such it acts a bit like a reference backend. Obviously, we shouldn't copy the bad bits of the matplotlib API but if a matplotlib parameter (and its values) are sensible, I don't see the problem with mirroring a convention that will be familiar to many people (with documentation online). I also have no issue with extending the possible values beyond what matplotlib supports (say Bokeh supported more arrow styles than matplotlib did). This would be similar to the situation described in #245. |
I agree with that overall assessment, Jean-Luc. |
I've used this issue to create the first notebook in the Edit: Just to say I see no reason why bokeh support wouldn't be easy to add. |
Bokeh support is mostly waiting on standardizing on a general API that supports arrows in any direction. |
http://bokeh.pydata.org/en/latest/docs/user_guide/annotations.html
|
Currently
Arrow
elements can only point along the cardinal directions.The text was updated successfully, but these errors were encountered: