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

Documentation: Add Examples for overlaying quad mesh. #3333

Open
wants to merge 4 commits into
base: RELEASE_next_minor
Choose a base branch
from

Conversation

CSSFrancis
Copy link
Member

Description of the change

Added an example for overlaying images. Kind of a fun example with lots of implications if people are interested in running with this. Also I'm kind of loving the Marker change for little things like this. :)

Progress of the PR

  • Change implemented (can be split into several points),
  • update docstring (if appropriate),
  • update user guide (if appropriate),
  • add an changelog entry in the upcoming_changes folder (see upcoming_changes/README.rst),
  • Check formatting changelog entry in the readthedocs doc build of this PR (link in github checks)
  • add tests,
  • ready for review.

Minimal example of the bug fix or the new feature

See documentation

@CSSFrancis
Copy link
Member Author

@magnunor You might find this fun/interesting :)

@ericpre We might want to think about adding a special class for hyperspy to make things like this easier in future. I could see something like an InsetMarker which just takes a square mesh and inlays some signal.

I also realize this is a weird way to do this in Matplotlib but still kind of fun.

@CSSFrancis
Copy link
Member Author

pyxem/pyxem#1031

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.55%. Comparing base (12e986f) to head (0b02fad).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           RELEASE_next_minor    #3333   +/-   ##
===================================================
  Coverage               80.55%   80.55%           
===================================================
  Files                     147      147           
  Lines                   21871    21871           
  Branches                 5144     5144           
===================================================
  Hits                    17618    17618           
  Misses                   3036     3036           
  Partials                 1217     1217           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@magnunor
Copy link
Contributor

This is really cool! I tried them, and they indeed work!

Having these as examples is nice, and I think they potentially could be useful for other visualization features. For example, one thing I've been thinking about for a while, is having a Signal2D equivalent version of the Signal1D "spectrum" . If you have a Signal1D, pressing the e key on your keyboard gives you a second navigator and the spectrum from this position is plotted in the same window as your main navigator.

Maybe using the transparent overlay would be a way to do this.

@ericpre
Copy link
Member

ericpre commented Mar 14, 2024

There is a variant of the colour wheel where the colour intensity increase from the center to the edge, for example:
https://www.nature.com/articles/s41565-022-01224-y/figures/1

I am wondering if this would be more simple using a polar transform in matplotlib?

@magnunor
Copy link
Contributor

I also tested both saving and loading these markers with .hspy, which worked nicely!

@magnunor
Copy link
Contributor

There is a variant of the colour wheel where the colour intensity increase from the center to the edge, for example: https://www.nature.com/articles/s41565-022-01224-y/figures/1

I am wondering if this would be more simple using a polar transform in matplotlib?

A similar colorwheel style is implemented in pyxem: https://github.com/pyxem/pyxem/blob/main/pyxem/utils/pixelated_stem_tools.py#L214

@CSSFrancis
Copy link
Member Author

I also tested both saving and loading these markers with .hspy, which worked nicely!

Cool I was wondering if that was going to work :) I thought it should but always good to check.

@CSSFrancis
Copy link
Member Author

There is a variant of the colour wheel where the colour intensity increase from the center to the edge, for example: https://www.nature.com/articles/s41565-022-01224-y/figures/1

I am wondering if this would be more simple using a polar transform in matplotlib?

@ericpre Probably would be a bit easier but stacking transforms in matplotlib always is a bit difficult to understand what's happening. I find myself wondering "where did my collection go?" a bit too much so I just stuck with cartesian coordinates and made a 360-gon.

@ericpre
Copy link
Member

ericpre commented Mar 14, 2024

@CSSFrancis
Copy link
Member Author

@ericpre I wonder if you could make this interactive using hs.interactive?

For example could you link the data from some inset quad mesh to an ROI? That might be useful if you wanted to integrate part of a navigator and plot the integrated signal as something like a call out.

I guess this is just a different way of handling something like #3325 but that might be a good first step to see how we could make #3325 a bit more flexible.

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.

None yet

3 participants