Skip to content

Support construct_color_bar for ImageStack glyph - #13289

Merged
ianthomas23 merged 2 commits into
branch-3.3from
ianthomas23/13288_image_stack_construct_color_bar
Aug 1, 2023
Merged

Support construct_color_bar for ImageStack glyph#13289
ianthomas23 merged 2 commits into
branch-3.3from
ianthomas23/13288_image_stack_construct_color_bar

Conversation

@ianthomas23

Copy link
Copy Markdown
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

codecov Bot commented Jul 27, 2023

Copy link
Copy Markdown

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

jbednar commented Jul 27, 2023

Copy link
Copy Markdown
Contributor

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

@ianthomas23

Copy link
Copy Markdown
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.

return ColorBar(color_mapper=text_color.transform, **kwargs)

elif type(self.glyph) is Image:
elif type(self.glyph) in (Image, ImageStack):

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@ianthomas23 ianthomas23 Jul 31, 2023

Copy link
Copy Markdown
Member Author

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

mattpap commented Jul 28, 2023

Copy link
Copy Markdown
Contributor

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
@github-actions

Copy link
Copy Markdown

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