Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add test_semilogx and test_semilogy tests to test_datetime #27320

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
Loading
from

Conversation

dwilliams27
Copy link

@dwilliams27 dwilliams27 commented Nov 14, 2023

PR summary

Adds test_semilogx and test_semilogy tests to test_datetime, resolving Axes.semilogx and Axes.semilogy in #26864

semilogx:
image
semilogy:
image

PR checklist

@dwilliams27
Copy link
Author

Let me know if I should use different ranges for test data/any other changes needed, happy to fix

Copy link

@github-actions github-actions bot left a 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 week or so, please leave a new comment below and that should bring it to our attention. 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.

@oscargus
Copy link
Member

Thanks!

I think that if one can include timedelta as well that would be great. That is, plotting the timedelta, rather than adding it (which is OK as such, but the plotting is still datetime).

(Do you agree with me that it seems like it is not properly working for dates? Not relevant for the test case writing, but these tests show that it doesn't work?)

@oscargus
Copy link
Member

Or, thinking twice, maybe one will have to use timedelta to get something sensible "log-like"? The "log-aspect" of the contemporary dates are probably rather small.

@ksunden
Copy link
Member

ksunden commented Nov 14, 2023

Timedeltas do not have first class support currently (see #8869 and linked PRs from there). They are used only when added to values.

Yes, log/semilog/etc axes with datetimes do not make much sense, as they are based on the 1970-01-01 zero mark for computing the scale, and so you are rarely working on multiple orders of magnitude where log scaling makes sense (and even when you are, the zero mark is completely arbitrary and unlikely to be related to your data).

Given that the implementation of semilog[xy] is really just some kwarg management over set_[xy]scale plus plot, the latter of which is already tested with datetimes and the former of which is tested pretty thoroughly independently, I think my vote would be to just omit the tests from the datetime file.

If we were to keep it (which, again, I'd argue we likely don't), just to prove that nothing about units prevents it from being applied, this is actually the case where using dates closer to 1970 (and spanning several decades, most likely) is likely beneficial, as it would make the scale transform visually apparent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.