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

Issue with long filenames in legend #2012

Closed
toqduj opened this issue Feb 1, 2022 · 7 comments
Closed

Issue with long filenames in legend #2012

toqduj opened this issue Feb 1, 2022 · 7 comments
Milestone

Comments

@toqduj
Copy link
Contributor

toqduj commented Feb 1, 2022

I've just come across this issue on Windows using 5.0.4. These measurements have long filenames, that generate legends just slightly larger than the plot window box, and it seems that that messes up the plot itself. Plots are a fraction of the full size of the box and tend to shrink further when interacting with that box (see screenshot).

Disabling the label from the right-click menu resolves this, but it reappears when the next fit is run (legend state is not maintained for plots).

This could be addressed in a plotting refactoring together with #1677

image

@RichardHeenan
Copy link
Contributor

Yes, this has been noted before, but not explicitly ticketed, it was once suggested that this is a "feature" of matplotlib, that would be tricky to solve. However I note that Mantid has managed to ignore the parts of long titles outside of the axis area, on either zooming in or else dragging the plot area smaller, which is better, but still not great. e.g. plot below where I renamed the workspace to have a very long name.
long_title
.

@toqduj
Copy link
Contributor Author

toqduj commented Feb 1, 2022

Plot labels can be capped to a certain number of characters as a quick fix...

@RichardHeenan
Copy link
Contributor

I'm just trying 5.0.5rc2 on Windows, where sasview legend boxes are being resized when changing the width of the plot, when they have a name of modest length. However if the workspace has a very long name to start with, then see plot issues as reported by Brian. (I loaded a workspace, then used right click, rename. Seems you can only rename before sending to a fit, not after). So unless there is a quick way to do what Mantid does so at least some sort of plot appears, I suspect a truncation is needed, then eventually a flag in the loader to complain when titles are too long.

@toqduj
Copy link
Contributor Author

toqduj commented Feb 2, 2022

From the look of the screenshots, it appears that the legend in Mantid is part of the plot axes, whereas for SasView it's part of the Figure. Perhaps that's where the problem arises from?

@rozyczko
Copy link
Member

rozyczko commented Feb 4, 2022

The legend is a part of the plot axes.

in Plotter.py, l. 254:

self.legend = ax.legend(loc='upper right', shadow=True, prop={'size':width})

where

ax = self.figure.add_subplot(self.current_plot)

with add_subplot returning axes of that plot

@butlerpd butlerpd added this to the SasView 5.1.0 milestone Feb 6, 2022
@smk78
Copy link
Contributor

smk78 commented Jun 22, 2022

Just to confirm that this problem still exists in 5.0.5.

@pbeaucage
Copy link
Contributor

Fixed in #2264 with additional usability workaround in #2266.

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

No branches or pull requests

6 participants