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

Add tutorial on numpy tooltip images #3202

Merged
merged 2 commits into from
Sep 25, 2023
Merged

Add tutorial on numpy tooltip images #3202

merged 2 commits into from
Sep 25, 2023

Conversation

joelostblom
Copy link
Contributor

close #3198

I thought about trying to fit this in the user guide, but it seems to be more of a tangent to me. Maybe we will make a user guide page on images in the future when there is a raster mark and we could also move this here, but for now my thinking is that it fits better in a tutorial as a more specific and advanced use case. I think having some more complex tutorials like this could be interesting, so feel free to contribute some if there are ideas (I can add another one on laying points out in the shape of density distributions from previous work).

Copy link
Contributor

@binste binste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of expanding the tutorial section with more complex use cases and this is a great one! Thanks @joelostblom. LGTM :)

doc/case_studies/numpy-tooltip-images.rst Show resolved Hide resolved
@jonmmease
Copy link
Contributor

I haven't reproduced locally, but I really like the example!

Thinking it might be worth calling out the fact that this may result in a large chart specification as all of the images are included in the spec (not just the one at a time that shows up in the tooltip).

@joelostblom
Copy link
Contributor Author

Thanks both! And good note about image sizes, I included this section:

Note that when including images as part of the chart data,
the chart size often increases several-fold.
The size of the chart above would have been 19 Kb without the images,
but with the images added it is 760 Kb.
While this is a 20x size increase,
the base64 encoding is still quite storage efficient;
if we would have included the images in their original Numpy array format
the chart size would have been 35Mb!

(Which reflects the sizes when the chart is saved as an html file)

@joelostblom joelostblom merged commit 5a7814c into main Sep 25, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add example showing how to render numpy image arrays as tooltip images
3 participants