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

Create category.pyi#30093

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
Santt997 wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromSantt997:patch-3
Open

Conversation

Santt997
Copy link

@Santt997Santt997 commentedMay 22, 2025
edited
Loading

PR summary

PR checklist

@story645
Copy link
Member

Hi@Santt997, I suggest you install and run the precommit hooks to help fix the linting errorshttps://matplotlib.org/devdocs/devel/development_setup.html#install-pre-commit-hooks

Comment on lines +1 to +11
"""
Plotting of string "category" data: ``plot(['d', 'f', 'a'], [1, 2, 3])`` will
plot three points with x-axis values of 'd', 'f', 'a'.

See :doc:`/gallery/lines_bars_and_markers/categorical_variables` for an
example.

The module uses Matplotlib's `matplotlib.units` mechanism to convert from
strings to integers and provides a tick locator, a tick formatter, and the
`.UnitData` class that creates and stores the string-to-integer mapping.
"""
Copy link
Member

Choose a reason for hiding this comment

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

The .pyi files don't typically have doc strings

class StrCategoryConverter(ConversionInterface):
@staticmethod
def convert(
value: Union[str, Iterable[str]],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
value:Union[str,Iterable[str]],
value:str|Iterable[str],

The .pyi files typically use the union operator rather than explicit union, please make this change to all the unions in this file
https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html


class StrCategoryFormatter(ticker.Formatter):
def __init__(self, units_mapping: Dict[str, int]) -> None: ...
def __call__(self, x: float, pos: Optional[int] = None) -> str: ...
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def__call__(self,x:float,pos:Optional[int]=None)->str: ...
def__call__(self,x:float,pos:int|None)->str: ...

also use the | convetion for optional, seehttps://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html


class UnitData:
_mapping: OrderedDict[Union[str, bytes], int]
def __init__(
Copy link
Member

Choose a reason for hiding this comment

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

I think._counter also needs to be documented

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@story645story645story645 left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
Status: Needs review
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Santt997@story645

[8]ページ先頭

©2009-2025 Movatter.jp