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

Plot label customisation widget #1920 #2096

Merged
merged 2 commits into from
Jun 17, 2022
Merged

Plot label customisation widget #1920 #2096

merged 2 commits into from
Jun 17, 2022

Conversation

rozyczko
Copy link
Member

Added a widget allowing for plot label customisation.
The widget is available from the context menu of any SasView plot as "Customize Labels", between "Toggle Legend" and "Change Scale"

Copy link
Contributor

@lucas-wilkins lucas-wilkins left a comment

Choose a reason for hiding this comment

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

  1. There still seems to be no control over the axis size (i.e. x/yticks)
  2. The box for the weights is a bit too small to show the weights (at least on my machine, but there are general issues with how things are scaled sometimes)

Added checkbox for applying style to tick labels.
Modified list of styles to correspond to 4.x
Cleaned up UI elements a bit
@rozyczko
Copy link
Member Author

Fixed both 1. and 2.

@wpotrzebowski wpotrzebowski merged commit cc6eaa2 into main Jun 17, 2022
@wpotrzebowski wpotrzebowski deleted the customize_labels branch June 17, 2022 15:38
@smk78
Copy link
Contributor

smk78 commented Jun 17, 2022

As changes had been merged to main, built & tested locally on W10/x64.

The only customizations that seem to work are changing the text string, changing the font size, and changing the font colour.

Changing the font, or the weighting, or applying the style to the axis numbers does not seem to do anything?

P.S. I'm building against MPL 2.2.3...

@lucas-wilkins
Copy link
Contributor

As changes had been merged to main, built & tested locally on W10/x64.

The only customizations that seem to work are changing the text string, changing the font size, and changing the font colour.

Changing the font, or the weighting, or applying the style to the axis numbers does not seem to do anything?

P.S. I'm building against MPL 2.2.3...

Matplotlib has the options for different fonts but when you use latex strings (as the default labels are), it uses the latex styling. If you want a different font in latex parts of the label, you'll have to use latex tags e.g. \mathbf for bold.

I don't think a system that would make this work, for example by modify the latex string, would work very well without giving SasView a deep understanding of latex. This would be a huge project. And doing it differently would be confusing for people who are used to matplotlib.

I would suggest that this is as good as it gets, and this difference is something that will have to be accepted as part of the move to matplotlib.

@rozyczko
Copy link
Member Author

To add to Lucas' note - it seems that 4.x behaves in the same way - if label is a non-Latex string, it will modify it accordingly, but will skip it entirely for $ delimited Latex strings.

@smk78
Copy link
Contributor

smk78 commented Jun 20, 2022

Fair enough. Then should we remove the font & weighting dropdowns?

@rozyczko
Copy link
Member Author

We could, but then the user would miss a way to modify the tick labels, which usually are not latex strings.
Also, often the axis labels are just text?

@lucas-wilkins
Copy link
Contributor

lucas-wilkins commented Jun 20, 2022 via email

@lucas-wilkins
Copy link
Contributor

lucas-wilkins commented Jun 20, 2022 via email

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.

4 participants