Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e6483a

Browse files
authored
Create category.pyi
1 parent a7c08c8 commit 3e6483a

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

lib/matplotlib/category.pyi

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
"""
2+
Plotting of string "category" data: ``plot(['d', 'f', 'a'], [1, 2, 3])`` will
3+
plot three points with x-axis values of 'd', 'f', 'a'.
4+
5+
See :doc:`/gallery/lines_bars_and_markers/categorical_variables` for an
6+
example.
7+
8+
The module uses Matplotlib's `matplotlib.units` mechanism to convert from
9+
strings to integers and provides a tick locator, a tick formatter, and the
10+
`.UnitData` class that creates and stores the string-to-integer mapping.
11+
"""
12+
13+
from __future__ import annotations
14+
from matplotlib.units import ConversionInterface, AxisInfo
15+
from matplotlib import ticker
16+
from matplotlib.axis import Axis
17+
from collections import OrderedDict
18+
import numpy as np
19+
from typing import Any, Dict, Iterable, List, Optional, Union
20+
21+
class StrCategoryConverter(ConversionInterface):
22+
@staticmethod
23+
def convert(
24+
value: Union[str, Iterable[str]],
25+
unit: UnitData,
26+
axis: Axis
27+
) -> Union[float, np.ndarray]: ...
28+
@staticmethod
29+
def axisinfo(unit: UnitData, axis: Axis) -> AxisInfo: ...
30+
@staticmethod
31+
def default_units(
32+
data: Union[str, Iterable[str]],
33+
axis: Axis
34+
) -> UnitData: ...
35+
@staticmethod
36+
def _validate_unit(unit: UnitData) -> None: ...
37+
38+
class StrCategoryLocator(ticker.Locator):
39+
def __init__(self, units_mapping: Dict[str, int]) -> None: ...
40+
def __call__(self) -> List[int]: ...
41+
def tick_values(self, vmin: Any, vmax: Any) -> List[int]: ...
42+
43+
class StrCategoryFormatter(ticker.Formatter):
44+
def __init__(self, units_mapping: Dict[str, int]) -> None: ...
45+
def __call__(self, x: float, pos: Optional[int] = None) -> str: ...
46+
def format_ticks(self, values: Iterable[float]) -> List[str]: ...
47+
@staticmethod
48+
def _text(value: Union[str, bytes]) -> str: ...
49+
50+
class UnitData:
51+
_mapping: OrderedDict[Union[str, bytes], int]
52+
def __init__(
53+
self,
54+
data: Optional[Iterable[Union[str, bytes]]] = None
55+
) -> None: ...
56+
def update(self, data: Iterable[Union[str, bytes]]) -> None: ...
57+
@staticmethod
58+
def _str_is_convertible(val: Union[str, bytes]) -> bool: ...

0 commit comments

Comments
 (0)