Skip to content

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

Merged

Conversation

ianthomas23
Copy link
Member

This adds support for construct_color_bar for ImageStack glyph. After this, the example in the referenced issue works.

@ianthomas23 ianthomas23 added this to the 3.3 milestone Jul 27, 2023
@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Merging #13289 (e94dccd) into branch-3.3 (d5ce3ec) will not change coverage.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           branch-3.3   #13289   +/-   ##
===========================================
  Coverage       92.44%   92.44%           
===========================================
  Files             315      315           
  Lines           20120    20120           
===========================================
  Hits            18599    18599           
  Misses           1521     1521           

@jbednar
Copy link
Contributor

jbednar commented Jul 27, 2023

Thanks! Can you show the output from the example that now works?

@ianthomas23
Copy link
Member Author

Thanks! Can you show the output from the example that now works?

Here it is:

Screenshot 2023-07-27 at 16 19 52

The appearance is the same as it was originally, this PR just hooks up the convenience function to create the ColorBar.

@@ -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):
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Member

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

Copy link
Member Author

@ianthomas23 ianthomas23 Jul 31, 2023

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.

@mattpap
Copy link
Contributor

mattpap commented Jul 28, 2023

The CI failure on Windows is real, but unrelated to this PR (it's Chromium 115 changed something).

@ianthomas23 ianthomas23 merged commit 38d05d0 into branch-3.3 Aug 1, 2023
@ianthomas23 ianthomas23 deleted the ianthomas23/13288_image_stack_construct_color_bar branch August 1, 2023 09:03
bryevdv pushed a commit that referenced this pull request Aug 11, 2023
* Support construct_color_bar for ImageStack glyph

* Use isinstance instead of type
@bryevdv bryevdv mentioned this pull request Aug 11, 2023
@bryevdv bryevdv modified the milestones: 3.3, 3.2.2 Aug 11, 2023
bryevdv pushed a commit that referenced this pull request Aug 12, 2023
* Support construct_color_bar for ImageStack glyph

* Use isinstance instead of type
Chiemezuo pushed a commit to Chiemezuo/bokeh that referenced this pull request Aug 27, 2024
* Support construct_color_bar for ImageStack glyph

* Use isinstance instead of type
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] construct_color_bar does not support ImageStack glyph
4 participants