Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Convert axis limit units in Qt plot options widget#19677

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jklymak merged 7 commits intomatplotlib:masterfromsoininen:qt_figureoptions_axis_limits_conversion
May 24, 2021
Merged

Convert axis limit units in Qt plot options widget#19677

jklymak merged 7 commits intomatplotlib:masterfromsoininen:qt_figureoptions_axis_limits_conversion
May 24, 2021

Conversation

soininen
Copy link
Contributor

PR Summary

Qt backend's plot options widget converts axis limits to floats regardless of the actual data type. If the axes use e.g. datetime values, this makes editing the axis limits next to impossible.

This tries to solve the problem at least for datetime values by converting them to a proper type that can be shown inQDateTime widget. The solution is probably not ideal as discussed in the issue but at least it helps users that regularly use datetime X axis a lot.

Resolves#19075

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

Copy link

@github-actionsgithub-actionsbot 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 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 uson gitter for real-time discussion.

For details on testing, writing docs, and our review process, please seethe developer guide

We strive to be a welcoming and open project. Please follow ourCode of Conduct.

Previously axis limits were converted to floats regardless of the actualvalue type in Qt backend's plot options widget. This commit makes datetimeaxis limits get converted to actual datetime values which areconsiderably easier to edit.Also, the methods used to convert the datetime values back have differentnames under PySide2 and PyQt. Previously the options widget was using themethods provided by PyQt only. We now support both Qt bindings.Re#19075
@jklymak
Copy link
Member

I don't use this widget, but this seems to be quite heavily leaning on special casing. Can you do something with the generic unit machinery?

@soininen
Copy link
ContributorAuthor

I don't use this widget, but this seems to be quite heavily leaning on special casing. Can you do something with the generic unit machinery?

This was discussed in the issue (#19075) and to my understanding there was a weak consesus of doing it this way in the absence of general unconverter. I understand theisinstance approach is not the best thing to do here. I can investigate other options but since I am not familiar with the code base any pointers would be very helpful.

@jklymakjklymak added the PR: bugfixPull requests that fix identified bugs labelMay 22, 2021
Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

I'll approve despite not liking the hack. I know@dstansby has been thinking about unconverters....



@pytest.mark.backend('Qt5Agg', skip_on_importerror=True)
def test_form_widget_get_with_date_field():
Copy link
Contributor

Choose a reason for hiding this comment

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

I would merge this test with the one above to avoid paying twice for the setup of the widget.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

widget = _formlayout.FormWidget(form)
widget.setup()
values = widget.get()
assert(values == [datetime(year=2021, month=3, day=11)])
Copy link
Contributor

Choose a reason for hiding this comment

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

assert needs no parentheses (it's not a function).

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

True. Thanks for the heads up!

Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

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

just two minor nits

soininen reacted with thumbs up emoji
@anntzer
Copy link
Contributor

anyone can merge postci

@jklymakjklymak merged commit8ecc571 intomatplotlib:masterMay 24, 2021
@QuLogicQuLogic added this to thev3.5.0 milestoneMay 26, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

@anntzeranntzeranntzer approved these changes

@jklymakjklymakjklymak approved these changes

Assignees
No one assigned
Labels
PR: bugfixPull requests that fix identified bugstopic: widgets/UI
Projects
None yet
Milestone
v3.5.0
Development

Successfully merging this pull request may close these issues.

Qt backend's Figure options to support axis units
4 participants
@soininen@jklymak@anntzer@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp