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

[FEATURE] Add fill properties to slope #9194

Open
kylrth opened this issue Aug 28, 2019 · 6 comments

Comments

@kylrth
Copy link
Member

@kylrth kylrth commented Aug 28, 2019

It'd be useful to have an annotation like BoxAnnotation that creates a dividing line, but which can be angled. It's possible to achieve something similar with an image, but then interaction is extremely slow as the plot has to re-render the image at every frame.

Using bands

This may be possible if we expand the features of the Band annotation. Currently, leaving lower or upper unspecified results in a blank figure, but we could change the behavior such that if either is unspecified the band continuous off infinitely.

I'd like to hear the thoughts of those more familiar with the capabilities of annotations.

@bryevdv

This comment has been minimized.

Copy link
Member

@bryevdv bryevdv commented Aug 28, 2019

I think allowing Band to continue off infinitely in one direction is a good feature, but it won't get you an infinite division, so I don't think it is this feature. One dimension of the band will always be finite (because explicit coordinates are used). In order to achieve an infinite "split" as asked about in the Discourse issue I would suggest adding two optional fill properties to Slope. The Slope annotation is naturally "infinite" already, so extending it to optionally fill either side of the infinite division would be fairly simple. Main observations:

  • what is the right terminology? left_fill_color makes sense until the slope is perfectly horizontal. I could live with a documented convention (e.g. left=above) for this special case, but maybe there are better names?

  • This only affords dividing the plane visually in to two pieces, not more. If there was really demand for multiple infinite bands we could add SlopeSet (to match LabelSet) but I'd want to see some sustained interest before putting work in to that.

@bryevdv bryevdv added this to the short-term milestone Aug 28, 2019
@kylrth

This comment has been minimized.

Copy link
Member Author

@kylrth kylrth commented Sep 3, 2019

If people are looking for a vertical line, they'll choose a Span, right? Can you even specify Slope(gradient=np.inf)? I think fill_above and fill_below (or some variant thereof) will always make sense for the parameters of a Slope object.

@bryevdv

This comment has been minimized.

Copy link
Member

@bryevdv bryevdv commented Sep 3, 2019

I had forgotten Slope is configured with an intercept and derivative (instead of a point and an angle, say) so yes I agree it's not possible to make a vertical slope, and that above/below are therefore well-defined always.

@kylrth

This comment has been minimized.

Copy link
Member Author

@kylrth kylrth commented Sep 3, 2019

Add this to the list of things I will "eventually" work on. :P

@bryevdv bryevdv changed the title [FEATURE] Infinite division with angled boundary [FEATURE] Add fill properties to slope Nov 4, 2019
@bryevdv

This comment has been minimized.

Copy link
Member

@bryevdv bryevdv commented Nov 4, 2019

Just noting that the way properties are named is slightly constrained, so for concreteness the proposal is to add above_fill_color and below_fill_color:

slope = Slope(gradient=gradient, y_intercept=y_intercept,
              line_color='orange', above_fill_color="red", below_fill_color="blue")

and similarly for above_fill_alpha and below_fill_alpha. It would be nice to also add above/below hatch properties at the same time but that's certainly a lower priority.

@graeme-hattan

This comment has been minimized.

Copy link

@graeme-hattan graeme-hattan commented Nov 11, 2019

If you add above_fill_color and below_fill_color to Slope, then what is missing is the ability to fill between slopes like you can for horizontal/vertical lines using BoxAnnotation. Maybe a better solution is along the lines of adding gradient parameters to BoxAnnotation (then probably renaming the class to something more descriptive and then making BoxAnnotation a subclass which sets up horizontal/vertical borders).

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