-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Support construct_color_bar for ImageStack glyph #13289
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
Support construct_color_bar for ImageStack glyph #13289
Conversation
Codecov Report
@@ Coverage Diff @@
## branch-3.3 #13289 +/- ##
===========================================
Coverage 92.44% 92.44%
===========================================
Files 315 315
Lines 20120 20120
===========================================
Hits 18599 18599
Misses 1521 1521 |
Thanks! Can you show the output from the example that now works? |
@@ -216,7 +217,7 @@ def construct_color_bar(self, **kwargs: Any) -> ColorBar: | |||
raise ValueError("expected text_color to be a field with a ColorMapper transform") | |||
return ColorBar(color_mapper=text_color.transform, **kwargs) | |||
|
|||
elif type(self.glyph) is Image: | |||
elif type(self.glyph) in (Image, ImageStack): |
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 using type(self.glyph)
instead of isinstance(self.glyph, ...)
prevents sub-classes to be allowed in this branch. If this is intentional, then I would suggest explaining the reason.
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 is intentional in the sense that this code was already using type(self.glyph)
and hence I have kept it on the basis of making the minimal set of changes to existing code to achieve what I want.
I am happy for it to remain using type
or change it to use isinstance
. Would you prefer the latter?
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.
I generally prefer such trivial things to be fixed in the same PR, rather than spending another PR on this, or worse tripping over such issue at some point in the future. If it was a more elaborate fix, then sure another PR would be preferred.
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.
+1 for changing in this PR
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.
Switched to using isinstance
in commit e94dccd
.
The CI failure on Windows is real, but unrelated to this PR (it's Chromium 115 changed something). |
* Support construct_color_bar for ImageStack glyph * Use isinstance instead of type
* Support construct_color_bar for ImageStack glyph * Use isinstance instead of type
* Support construct_color_bar for ImageStack glyph * Use isinstance instead of type
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. |
This adds support for
construct_color_bar
forImageStack
glyph. After this, the example in the referenced issue works.