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

silx.gui.plot.PlotWidget: Updated plot axes tick labels behavior #4007

Merged
merged 5 commits into from
Dec 19, 2023

Conversation

t20100
Copy link
Member

@t20100 t20100 commented Dec 15, 2023

This PR changes the configuration of matplotlib tick label ScalarFormatter to enable offset, scientific notation and math text to format tick labels.

The behavior of the formatter has changed over time and here are some examples of the behavior as of today: no offset/scientific notation | scientific notation only around 0 | ofset + scientific notation

Screen Shot 2023-12-15 at 11 34 01

closes #3997

@t20100 t20100 added this to the 2.0.0 milestone Dec 15, 2023
@t20100 t20100 requested a review from vallsv December 15, 2023 10:38
_logger.warning(
"Cannot disabled axes offsets in %s " % matplotlib.__version__
)
# Configure axes tick label formatter
Copy link
Member Author

Choose a reason for hiding this comment

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

There is no need for try/execpt at least from matplotlib >= 1.2.0 which is the minimum version advertised in setup.py.

@vallsv
Copy link
Contributor

vallsv commented Dec 15, 2023

If mpl switch automatically for us, it's fine for me.

It's anyway better than having the same labels in the axis.

@t20100 t20100 force-pushed the plot-update-mpl-tick-formatter branch from 1274f85 to 2181492 Compare December 15, 2023 16:21
@t20100 t20100 changed the title silx.gui.plot.PlotWidget: Updated plot axes tick labels with matplotlib backend silx.gui.plot.PlotWidget: Updated plot axes tick labels behavior Dec 15, 2023
@t20100
Copy link
Member Author

t20100 commented Dec 15, 2023

Added: using the same Formatter class for OpenGL backend, so the plot tick labels and order of magnitude+offset text behaves the same for both matplotlib and OpenGL backends.

@vallsv
Copy link
Contributor

vallsv commented Dec 15, 2023

NIce 👍

@t20100 t20100 removed the question label Dec 18, 2023
@t20100
Copy link
Member Author

t20100 commented Dec 18, 2023

Updated to fix an issue when switching linear/log scale, the "formatter" was not correctly updated (this issue was there before this PR).

@t20100
Copy link
Member Author

t20100 commented Dec 18, 2023

Ready for review

@vallsv vallsv merged commit 3c55453 into silx-kit:main Dec 19, 2023
1 check failed
@t20100 t20100 deleted the plot-update-mpl-tick-formatter branch January 15, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PlotWidget tick labels are all the same for very small data range
2 participants