Skip to content

Conversation

KyleQianliMa
Copy link
Contributor

@KyleQianliMa KyleQianliMa commented Apr 24, 2025

Description of work

This PR re-introduces crosshair into mantidworkbench plotting module. EWM 10075.
To address part of the issue found during smoking test, the crosshair is automatically disabled in titled plots, enabled in contour plots. There will be a following PR to also disable this in 3D plots to address EWM 10076.

Summary of work

Fixes #xxxx.

Further detail of work

To test:

Testing is easy, check 3 things: 1. crosshair is enabled in general single axis plots. 2. check it's disabled in tiled plots. 3. check it's enabled in contour plots.

To test crosshair is enabled in single-axis plot, either load any data you have or do:

plt.plot([1,2,3], [3,2,1])
plt.show()

check crosshair can be enabled and works properly.
image

To test crosshair is disabled in titled plots, do:

fig, ax = plt.subplots(2,2)
ax[0,0].plot([1,2,3],[3,2,1])
ax[0,1].plot([1,2,3],[1,2,3])
plt.show()

the crosshair button should be hidden from user now.
image
.

Finally, to test the crosshair is enabled in contour plots, do:

data = Load('SANSLOQCan2D.nxs')

fig, axes = plt.subplots(subplot_kw={'projection':'mantid'})

# IMPORTANT to set origin to lower
c = axes.imshow(data, origin = 'lower', cmap='viridis', aspect='auto')

# Overlay contours
axes.contour(data, levels=np.linspace(10, 60, 6), colors='yellow', alpha=0.5)
axes.set_title('SANSLOQCan2D.nxs')
cbar=fig.colorbar(c)
cbar.set_label('Counts ($\mu s$)$^{-1}$') #add text to colorbar
fig.tight_layout()

fig.show()

crosshair button is back and can be enabled.
image

In all three scenarios, changing axes scale from linear to log should not cause anything to crash.


Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@KyleQianliMa KyleQianliMa changed the base branch from main to ornl-next April 24, 2025 18:25
@KyleQianliMa KyleQianliMa changed the base branch from ornl-next to main April 24, 2025 18:26
@KyleQianliMa KyleQianliMa added this to the Release 6.13 milestone Apr 25, 2025
@KyleQianliMa KyleQianliMa added GUI Issues and pull requests specific to the Mantid Workbench GUI. ORNL Team Issues and pull requests managed by the ORNL development team labels Apr 25, 2025
@KyleQianliMa KyleQianliMa marked this pull request as ready for review April 28, 2025 15:18
@peterfpeterson peterfpeterson merged commit 297e6fa into main Apr 30, 2025
10 checks passed
@peterfpeterson peterfpeterson deleted the crosshair branch April 30, 2025 17:26
@KyleQianliMa KyleQianliMa mentioned this pull request May 1, 2025
KyleQianliMa added a commit that referenced this pull request May 1, 2025
### Description of work
copy of PR [39242](#39242)
into ORNL next
#### Summary of work
<!-- Please provide a short, high level description of the work that was
done.
-->

<!-- Why has this work been done? If there is no linked issue please
provide appropriate context for this work.
#### Purpose of work
This can be removed if a github issue is referenced below
-->

Fixes #xxxx. <!-- and fix #xxxx or close #xxxx xor resolves #xxxx. One
line per issue fixed. -->
<!-- alternative
*There is no associated issue.*
-->

<!-- If the original issue was raised by a user they should be named
here. Do not leak email addresses
**Report to:** [user name]
-->

#### Further detail of work
<!-- Please provide a more detailed description of the work that has
been undertaken.
-->

### To test:

<!-- Instructions for testing.
There should be sufficient instructions for someone unfamiliar with the
application to test - unless a specific
reviewer is requested.
If instructions for replicating the fault are contained in the linked
issue then it is OK to refer back to these.
-->

<!-- delete this if you added release notes
*This does not require release notes* because **fill in an explanation
of why**
If you add release notes please save them as a separate file using the
Issue or PR number as the file name. Check the file is located in the
correct directory for your note(s).
-->

<!-- Ensure the base of this PR is correct (e.g. release-next or main)
Finally, don't forget to add the appropriate labels, milestones, etc.!
-->

---

### Reviewer

Please comment on the points listed below ([full
description](http://developer.mantidproject.org/ReviewingAPullRequest.html)).
**Your comments will be used as part of the gatekeeper process, so
please comment clearly on what you have checked during your review.** If
changes are made to the PR during the review process then your final
comment will be the most important for gatekeepers. In this comment you
should make it clear why any earlier review is still valid, or confirm
that all requested changes have been addressed.

#### Code Review

- Is the code of an acceptable quality?
- Does the code conform to the [coding
standards](http://developer.mantidproject.org/Standards/)?
- Are the unit tests small and test the class in isolation?
- If there is GUI work does it follow the [GUI
standards](http://developer.mantidproject.org/Standards/GUIStandards.html)?
- If there are changes in the release notes then do they describe the
changes appropriately?
- Do the release notes conform to the [release notes
guide](https://developer.mantidproject.org/Standards/ReleaseNotesGuide.html)?

#### Functional Tests

- Do changes function as described? Add comments below that describe the
tests performed?
- Do the changes handle unexpected situations, e.g. bad input?
- Has the relevant (user and developer) documentation been
added/updated?

Does everything look good? Mark the review as **Approve**. A member of
`@mantidproject/gatekeepers` will take care of it.

### Gatekeeper

If you need to request changes to a PR then please add a comment and set
the review status to "Request changes". This will stop the PR from
showing up in the list for other gatekeepers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI Issues and pull requests specific to the Mantid Workbench GUI. ORNL Team Issues and pull requests managed by the ORNL development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants