-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Set more sensible defaults in BoxAnnotation #13468
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
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## branch-3.4 #13468 +/- ##
===========================================
Coverage 92.57% 92.57%
===========================================
Files 322 322
Lines 20460 20460
===========================================
Hits 18940 18940
Misses 1520 1520 |
2826ff7
to
a51238b
Compare
a51238b
to
a777a7d
Compare
from bokeh.plotting import figure, show | ||
|
||
p = figure(width=600, height=200, tools='') | ||
p.line([1, 2, 3], [1, 2, 1], line_color="#0072B2") | ||
pink_line = p.line([1, 2, 3], [2, 1, 2], line_color="#CC79A7") | ||
|
||
green_box = BoxAnnotation(left=1.5, right=2.5, fill_color='#009E73', fill_alpha=0.1) | ||
green_box = BoxAnnotation(left=1.5, right=2.5, top=Node.frame.top, bottom=Node.frame.bottom, fill_color='#009E73', fill_alpha=0.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for demonstration, or required? I don't think having to explicitly specify this is an improvement, or what users would normally want to have to do to have the box be "unbounded" in a direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now required. Note that BoxAnnotation
doesn't imply that it's bound to frame in any capacity (it's just a historical artifact), so unspecified positioning properties don't give a clue what the behavior will be (i.e. will it span, will it show at all?). It should be possible to attach it to anything like canvas or a panel or another box annotation. The syntax is indeed verbose, but at least the behavior is clear. BoxAnnotation
wasn't ever a truly unbounded annotation, because it always draws lines on all sides and doesn't hit test at infinity, two things that {H,V}Strip
glyphs do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that BoxAnnotation doesn't imply that it's bound to frame in any capacity (it's just a historical artifact)
I'm not sure where this is coming from, but it is not correct. "missing bound = extend to plot edge" was an explicit design criteria of the original BoxAnnotation
and is also what is and has been officially documented:
To define the bounds of these boxes, use the left/right or top/ bottom properties. If you provide only one bound (for example, a left value but no right value), the box will extend to the edge of the available plot area for the dimension you did not specify.
I'm pretty sure I am 👎 on this change as-is in general, but I am defintely 👎 on backporting such a breaking change to a point release.
a777a7d
to
7855b49
Compare
Attempting to regain some movement on this PR. @mattpap is the plan to deprecate |
7855b49
to
462d4d7
Compare
I reverted the defaults, so that they are not required anymore and point to symbolic nodes of the frame. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
fixes #13432