Skip to content

Add a flag to show_geometry that allows for disabling the call to plt.show() - #2195

Merged
lauramurgatroyd merged 6 commits into
TomographicImaging:masterfrom
hussam-stfc:2194-show-geometry-add-new-flag
Aug 12, 2025
Merged

Add a flag to show_geometry that allows for disabling the call to plt.show()#2195
lauramurgatroyd merged 6 commits into
TomographicImaging:masterfrom
hussam-stfc:2194-show-geometry-add-new-flag

Conversation

@hussam-stfc

@hussam-stfc hussam-stfc commented Jul 31, 2025

Copy link
Copy Markdown
Contributor

Description

This change was requested by the Mantid Imaging project (https://github.com/mantidproject/mantidimaging)

The following changes have been made:

  • Added the show flag to the show_geometry class with a default value of True
  • Made the call to plt.show() conditional on the show flag
  • Updated show_geometry docstring
  • Changelog

Example Usage

Creating an instance of show_geometry(show=False) no longer spawns the Matplotlib figure window.

Checklist

  • I have performed a self-review of my code
  • CHANGELOG.md has been updated with any functionality change
  • Change pull request label to 'Waiting for review'
  • I have updated docstrings in line with the guidance in the developer guide

….show() (TomographicImaging#2194)

* This change was requested by the Mantid Imaging project (https://github.com/mantidproject/mantidimaging)
* Add the `show` flag to the `show_geometry` class with a default value of True
* Update `show_geometry` docstring
* Changelog

---------

Signed-off-by: Hussam Alhassan <[email protected]>
@hussam-stfc

Copy link
Copy Markdown
Contributor Author

Please let me know if I can improve the code, commit message, or issue/PR contents

@hussam-stfc
hussam-stfc marked this pull request as ready for review July 31, 2025 15:57

@hrobarts hrobarts left a comment

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.

Hi Hussam, thank you for your contribution this looks great. Would you be able to add a description of the new argument to the show_geometry docstring?

@hussam-stfc

Copy link
Copy Markdown
Contributor Author

Hi Hannah, do you mean adding some more detail to the "Show Matplotlib figure window, default=True" part?

We could write "Controls whether Matplotlib spawns a visualiser window by running show() on the generated plot", does that sound ok? If so I can update the PR

@hussam-stfc
hussam-stfc requested a review from hrobarts August 11, 2025 15:32
@hrobarts

Copy link
Copy Markdown
Contributor

Hi Hussam, ah sorry I missed that you'd already added to the docstring! I think your existing text is good, it's clear to me what you mean.
I'm happy to approve if you resolve the conflicts.

@lauramurgatroyd

Copy link
Copy Markdown
Member

Hi, I've resolved the conflicts. I'm going to add you as a CIL contributor, and then we'll be ready to merge.

Signed-off-by: Laura Murgatroyd <[email protected]>
Signed-off-by: Laura Murgatroyd <[email protected]>
@lauramurgatroyd
lauramurgatroyd dismissed hrobarts’s stale review August 12, 2025 08:45

Changes have been made

Signed-off-by: Laura Murgatroyd <[email protected]>
Signed-off-by: Laura Murgatroyd <[email protected]>
@lauramurgatroyd

Copy link
Copy Markdown
Member

Sorry I got a little mixed up with the docstring but resolved it now

@lauramurgatroyd
lauramurgatroyd merged commit 8ab1113 into TomographicImaging:master Aug 12, 2025
11 checks passed
@hussam-stfc

Copy link
Copy Markdown
Contributor Author

Thank you for the review!

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.

3 participants