-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Enhancing support for tex and datetimes #21568
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a new test for the failing case as well? (Unless I missed it).
I can't seem to get the unit test that I want to work. I want to add the case to matplotlib/lib/matplotlib/tests/test_dates.py Lines 324 to 341 in f0632c0
by adding the following: @pytest.mark.parametrize('delta, expected', [
...
(datetime.timedelta(minutes=10),
[r'$\mathdefault{01\;00{:}%02d}$' % minu for minu in range(0, 11)]),
])
def test_date_formatter_usetex(delta, expected):
... But I get an assertion error that the output is in a different format:
But when I run this script (just copied the function), it gives no assertion error. import datetime
import matplotlib.dates as mdates
delta = datetime.timedelta(minutes=10)
expected = [r'$\mathdefault{01\;00{:}%02d}$' % minu for minu in range(0, 11)]
d1 = datetime.datetime(1990, 1, 1)
d2 = d1 + delta
locator = mdates.AutoDateLocator(interval_multiples=False)
locator.create_dummy_axis()
locator.axis.set_view_interval(mdates.date2num(d1), mdates.date2num(d2))
formatter = mdates.AutoDateFormatter(locator, usetex=True)
assert [formatter(loc) for loc in locator()] == expected Am I doing anything wrong? |
I can't look at details right now but tests are run under different defaults than current matplotlib. It's possible one of those has changed. |
In It would be great if you could update the test to modern matplotlib default formats, as we really should be testing those, and not the pre 2.0 ones ;-) |
…568-on-v3.5.x Backport PR #21568 on branch v3.5.x (Enhancing support for tex and datetimes)
PR Summary
Fixes #21518
Add braces to
:
and replace space with\;
when wrapping string to tex.PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).