Skip to content

Fix slicer re #363#364

Merged
jcapriot merged 8 commits intomainfrom
fix-for-363
Sep 2, 2024
Merged

Fix slicer re #363#364
jcapriot merged 8 commits intomainfrom
fix-for-363

Conversation

@prisae
Copy link
Member

@prisae prisae commented Jul 29, 2024

This is really an edge case, not high priority at all (more of cosmetic nature than anything else). Closes #363.

@codecov
Copy link

codecov bot commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 85.96491% with 8 lines in your changes missing coverage. Please review.

Project coverage is 86.25%. Comparing base (ffd4e04) to head (d44f849).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
examples/plot_slicer_demo.py 0.00% 7 Missing ⚠️
discretize/mixins/mpl_mod.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #364      +/-   ##
==========================================
+ Coverage   85.76%   86.25%   +0.49%     
==========================================
  Files          88       89       +1     
  Lines       18654    18695      +41     
  Branches     2959     2959              
==========================================
+ Hits        15998    16125     +127     
+ Misses       1996     1884     -112     
- Partials      660      686      +26     

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

@jcapriot
Copy link
Member

jcapriot commented Sep 1, 2024

Hey @prisae, the logic for this choosing of vmin and vmax was getting a bit convoluted to me. So, I just changed it myself here :). This mimics what matplotlib does internally (Creating a Normalize() object if there is no norm, and then calling autoscale_None on the norm. This should make it so all three plots have a consistent norm and catch all these odd edge cases.

It's worked in my quick tests, but feel free to check for yourself first.

@prisae
Copy link
Member Author

prisae commented Sep 2, 2024

That looks much better @jcapriot, great! I tested it and it works on my side. Not sure why the documentation test is failing... 🤔

@jcapriot
Copy link
Member

jcapriot commented Sep 2, 2024

Ok, I’ll get the doc test fixed and then merge it.

@jcapriot
Copy link
Member

jcapriot commented Sep 2, 2024

Okay, a few things.

  • I moved the plt.show out of the plot_3d_slicer call (Made you unable to interact with the figure before showing it when running from a terminal, or running it as a script).
  • Did need to filter out the nans when using autoscale.
  • Needed to make sure it was a 1D array going in to it (for some norms... odd that this behavior is not consistent on matplotlib's end).

Copy link
Member

@jcapriot jcapriot left a comment

Choose a reason for hiding this comment

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

Ok!

@jcapriot jcapriot merged commit bd5bfa4 into main Sep 2, 2024
@jcapriot jcapriot deleted the fix-for-363 branch September 2, 2024 17:24
@prisae
Copy link
Member Author

prisae commented Sep 2, 2024

Thanks Joe! I will check tomorrow at work with all my examples, but it looks logic, might just need some adjustments in the examples regarding the plt.show(). Might be worth to make a note in that regard in the release notes.

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.

3D Slicer Bug

2 participants