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

Add __repr__ to Formatter and Locator classes#30876

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

Open
DavidAGInnovation wants to merge2 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromDavidAGInnovation:feature/add-repr-to-ticker-classes

Conversation

@DavidAGInnovation
Copy link

Summary

Closes#21898

Added informative__repr__ methods to all Formatter and Locator subclasses inmatplotlib.ticker, so thateval(repr(obj)) returns an equivalent object.

Formatters (9 classes):

  • NullFormatter
  • FixedFormatter
  • FuncFormatter
  • FormatStrFormatter
  • StrMethodFormatter
  • LogFormatter
  • LogitFormatter
  • EngFormatter
  • PercentFormatter

Locators (12 classes):

  • NullLocator
  • FixedLocator
  • IndexLocator
  • LinearLocator
  • MultipleLocator
  • MaxNLocator
  • AutoLocator
  • AutoMinorLocator
  • LogLocator
  • SymmetricalLogLocator
  • AsinhLocator
  • LogitLocator

Additional fixes:

  • Fixed twopytest.mark.parametrize deprecation warnings (PytestRemovedIn10Warning) that were usingzip iterators instead of lists.

Testing

  • All 550 tests intest_ticker.py pass
  • Manual verification of all__repr__ methods

Example outputs:

>>>repr(mticker.NullFormatter())'NullFormatter()'>>>repr(mticker.MaxNLocator())'MaxNLocator(nbins=10, steps=[1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0])'>>>repr(mticker.LogLocator())'LogLocator(base=10.0, numticks=auto)'

Added informative __repr__ methods to all Formatter and Locatorsubclasses in matplotlib.ticker, so that eval(repr(obj)) returnsan equivalent object.Formatters:- NullFormatter- FixedFormatter- FuncFormatter- FormatStrFormatter- StrMethodFormatter- LogFormatter- LogitFormatter- EngFormatter- PercentFormatterLocators:- NullLocator- FixedLocator- IndexLocator- LinearLocator- MultipleLocator- MaxNLocator- AutoLocator- AutoMinorLocator- LogLocator- SymmetricalLogLocator- AsinhLocator- LogitLocatorAlso fixed two pytest.mark.parametrize deprecation warnings thatwere using zip iterators instead of lists.
@story645
Copy link
Member

Hi@DavidAGInnovation. Thanks for the PR. Can you please strip out the formatting changes because they're making it difficult to review your implementation.

The 10 second timeout was too short for Windows CI, causingintermittent failures. Increased to 30 seconds to providesufficient headroom on slow CI machines.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Reprs on formatters and locaters

2 participants

@DavidAGInnovation@story645

[8]ページ先頭

©2009-2025 Movatter.jp