Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Add type stubs for Axes3D and improve type hints in _AxesBase#30713
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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
e59988989e5545e7e3d421852fc6563fbb2File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5066,7 +5066,7 @@ def invalid_shape_exception(csize, xsize): | ||
| "facecolors", "color"], | ||
| label_namer="y") | ||
| @_docstring.interpd | ||
| def scatter(self, x, y,z=0,s=None, c=None, marker=None, cmap=None, norm=None, | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. You can't change the signature of Axes methods. Please revert. | ||
| vmin=None, vmax=None, alpha=None, linewidths=None, *, | ||
| edgecolors=None, colorizer=None, plotnonfinite=False, **kwargs): | ||
| """ | ||
| @@ -5077,6 +5077,10 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, | ||
| x, y : float or array-like, shape (n, ) | ||
| The data positions. | ||
| zs : float or array-like, default: 0 | ||
| The z-positions. Either an array of the same length as *xs* and | ||
| *ys* or a single value to place all points in the same plane. | ||
| s : float or array-like, shape (n, ), optional | ||
| The marker size in points**2 (typographic points are 1/72 in.). | ||
| Default is ``rcParams['lines.markersize'] ** 2``. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -41,6 +41,60 @@ class _axis_method_wrapper: | ||
| ) -> None: ... | ||
| def __set_name__(self, owner: Any, name: str) -> None: ... | ||
| class _TransformedBoundsLocator: | ||
| _bounds: Sequence[float] | ||
| _transform: Transform | ||
| def __init__(self, bounds: Sequence[float], transform: Transform) -> None: ... | ||
| def __call__(self, ax: Any, renderer: Any) -> Bbox: ... | ||
Comment on lines +48 to +50 Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Don't need the blank lines between methods in type stubs. | ||
| def _process_plot_format( | ||
| fmt: str, | ||
| *, | ||
| ambiguous_fmt_datakey: bool = False | ||
| ) -> tuple[str | None, str | None, ColorType | None]: ... | ||
| class _process_plot_var_args: | ||
| output: str | ||
| def __init__(self, output: str = ...) -> None: ... | ||
| def set_prop_cycle(self, cycler: Any) -> None: ... | ||
| def __call__( | ||
| self, | ||
| axes: Any, | ||
| *args: Any, | ||
| data: Any | None = ..., | ||
| return_kwargs: bool = ..., | ||
| **kwargs: Any, | ||
| ) -> Iterator[Any]: ... | ||
| def get_next_color(self) -> Any: ... | ||
| def _getdefaults(self, kw: dict[str, Any], ignore: Any = ...) -> dict[str, Any]: ... | ||
| def _setdefaults(self, defaults: dict[str, Any], kw: dict[str, Any]) -> None: ... | ||
| def _make_line(self, axes: Any, x: Any, y: Any, kw: dict[str, Any], kwargs: dict[str, Any]) -> tuple[Any, dict[str, Any]]: ... | ||
| def _make_coordinates(self, axes: Any, x: Any, y: Any, kw: dict[str, Any], kwargs: dict[str, Any]) -> tuple[Any, dict[str, Any]]: ... | ||
| def _make_polygon(self, axes: Any, x: Any, y: Any, kw: dict[str, Any], kwargs: dict[str, Any]) -> tuple[Any, dict[str, Any]]: ... | ||
| def _plot_args( | ||
| self, | ||
| axes: Any, | ||
| tup: tuple[Any, ...], | ||
| kwargs: dict[str, Any], | ||
| *, | ||
| return_kwargs: bool = ..., | ||
| ambiguous_fmt_datakey: bool = ..., | ||
| ) -> Iterator[Any]: ... | ||
| class _AxesBase(martist.Artist): | ||
| name: str | ||
| patch: Patch | ||
| @@ -64,6 +118,9 @@ class _AxesBase(martist.Artist): | ||
| title: Text | ||
| _axis_map: dict[str, Axis] | ||
| _projection_init: Any | ||
| _axis_names: tuple[Literal['x'], Literal['y']] | tuple[Literal['x'], Literal['y'], Literal['z']] | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This type is definitely not literals. | ||
| _shared_axes: dict[str, cbook.Grouper] | ||
| _twinned_axes: list[cbook.Grouper] | ||
| def __init__( | ||
| self, | ||
| @@ -462,3 +519,10 @@ class _AxesBase(martist.Artist): | ||
| ) -> list[Text]: ... | ||
| def xaxis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ... | ||
| def yaxis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ... | ||
| def _draw_rasterized( | ||
| figure: Figure, | ||
| artists: list[Artist], | ||
| renderer: RendererBase, | ||
| ) -> None: ... | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -70,7 +70,7 @@ | ||
| ---------- | ||
| fig : Figure | ||
| The parent figure. | ||
| rect : tuple (left, bottom, width, height), default:None | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This change is unrelated, and incorrect. | ||
| The ``(left, bottom, width, height)`` Axes position. | ||
| elev : float, default: 30 | ||
| The elevation angle in degrees rotates the camera above and below | ||
| @@ -246,7 +246,7 @@ | ||
| @_api.delete_parameter("3.11", "share") | ||
| @_api.delete_parameter("3.11", "anchor") | ||
| def set_aspect(self, aspect, adjustable=None): | ||
| """ | ||
| Set the aspect ratios. | ||
| @@ -663,10 +663,10 @@ | ||
| def get_w_lims(self): | ||
| """Get 3D world limits.""" | ||
| minx, maxx = self.get_xlim() | ||
| miny, maxy = self.get_ylim() | ||
| minz, maxz = self.get_zlim() | ||
| return(minx, maxx, miny, maxy, minz, maxz) | ||
| def _set_bound3d(self, get_bound, set_lim, axis_inverted, | ||
| lower=None, upper=None, view_margin=None): | ||
| @@ -1013,7 +1013,7 @@ | ||
| def get_xlim(self): | ||
| # docstring inherited | ||
| return (self.xy_viewLim.intervalx) | ||
| def get_ylim(self): | ||
| # docstring inherited | ||
| @@ -1192,7 +1192,7 @@ | ||
| self._focal_length = np.inf | ||
| def _roll_to_vertical( | ||
| self, arr, reverse: bool = False | ||
| ) -> np.ndarray: | ||
| """ | ||
| Roll arrays to match the different vertical axis. | ||
| @@ -1215,9 +1215,9 @@ | ||
| # Transform to uniform world coordinates 0-1, 0-1, 0-1 | ||
| box_aspect = self._roll_to_vertical(self._box_aspect) | ||
| worldM = proj3d.world_transformation( | ||
| *self.get_xlim(), | ||
| *self.get_ylim(), | ||
| *self.get_zlim(), | ||
| pb_aspect=box_aspect, | ||
| ) | ||
| @@ -1502,7 +1502,7 @@ | ||
| p2 = p1 - scale*vec | ||
| return p2, pane_idx | ||
| def _arcball(self, x, y): | ||
| """ | ||
| Convert a point (x, y) to a point on a virtual trackball. | ||
| @@ -1808,7 +1808,7 @@ | ||
| dx = (maxx - minx) | ||
| dy = (maxy - miny) | ||
| dz = (maxz - minz) | ||
| return(cx, cy, cz, dx, dy, dz) | ||
| def set_zlabel(self, zlabel, fontdict=None, labelpad=None, **kwargs): | ||
| """ | ||
| @@ -2559,9 +2559,18 @@ | ||
| return polyc | ||
| def _3d_extend_contour(self, cset, stride = 5) -> None: | ||
Check warning on line 2562 in lib/mpl_toolkits/mplot3d/axes3d.py
| ||
| """ | ||
| Extend a 2D contour set into 3D space by generating vertical faces between | ||
| contour levels. | ||
| Parameters | ||
| ---------- | ||
| cset : matplotlib.contour.QuadContourSet | ||
| The contour set (returned by plt.contour or ax.contour) whose levels | ||
| and paths will be extended into 3D. | ||
| stride : int, optional | ||
| Sampling stride for contour segments to reduce polygon count. | ||
| """ | ||
| dz = (cset.levels[1] - cset.levels[0]) / 2 | ||
| @@ -2986,7 +2995,7 @@ | ||
| if np.may_share_memory(zs_orig, zs): # Avoid unnecessary copies. | ||
| zs = zs.copy() | ||
| patches = super().scatter(xs, ys,zs,s=s, c=c, *args, **kwargs) | ||
| art3d.patch_collection_2d_to_3d( | ||
| patches, | ||
| zs=zs, | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.