From 2a1e436808c8daa08352bb7f93b38c6e4a2f3cdd Mon Sep 17 00:00:00 2001 From: AnanasClassic <114666468+AnanasClassic@users.noreply.github.com> Date: Fri, 19 May 2023 18:05:29 +0300 Subject: [PATCH 1/7] add Axes.transData --- doc/api/axes_api.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/api/axes_api.rst b/doc/api/axes_api.rst index 3457368fa51c..06ce9622a213 100644 --- a/doc/api/axes_api.rst +++ b/doc/api/axes_api.rst @@ -586,6 +586,8 @@ non-rectilinear Axes. Axes.get_yaxis_text1_transform Axes.get_yaxis_text2_transform + Axes.transData + Other ===== From 8cb81185c70e070deb652cfdb9a5c8a406545ce8 Mon Sep 17 00:00:00 2001 From: AnanasClassic <114666468+AnanasClassic@users.noreply.github.com> Date: Fri, 19 May 2023 18:10:50 +0300 Subject: [PATCH 2/7] Update _base.py --- lib/matplotlib/axes/_base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index fb04d917720f..c08cf2c715bd 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -561,6 +561,12 @@ class _AxesBase(martist.Artist): _subclass_uses_cla = False + transData = None # Transform object + """ + a transformation object that converts data coordinates into a + coordinate system used to display data on graph axes + """ + @property def _axis_map(self): """A mapping of axis names, e.g. 'x', to `Axis` instances.""" From f15b7769ff2657b0a7c3897b28e8fe00ccf35af7 Mon Sep 17 00:00:00 2001 From: AnanasClassic <114666468+AnanasClassic@users.noreply.github.com> Date: Fri, 19 May 2023 18:16:14 +0300 Subject: [PATCH 3/7] moved the transData attribute declaration to _base.py --- lib/matplotlib/axes/_base.pyi | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.pyi b/lib/matplotlib/axes/_base.pyi index 7cf5f166ae30..4018d2a97f58 100644 --- a/lib/matplotlib/axes/_base.pyi +++ b/lib/matplotlib/axes/_base.pyi @@ -49,7 +49,6 @@ class _AxesBase(martist.Artist): transAxes: Transform transScale: Transform transLimits: Transform - transData: Transform ignore_existing_data_limits: bool axison: bool _projection_init: Any From 22fe42b2933f653d2d0b80ed333d9f74cf736a6f Mon Sep 17 00:00:00 2001 From: AnanasClassic <114666468+AnanasClassic@users.noreply.github.com> Date: Sun, 21 May 2023 23:02:49 +0300 Subject: [PATCH 4/7] add transXYZ attributes --- doc/api/axes_api.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/axes_api.rst b/doc/api/axes_api.rst index 06ce9622a213..d2f76e089389 100644 --- a/doc/api/axes_api.rst +++ b/doc/api/axes_api.rst @@ -586,6 +586,9 @@ non-rectilinear Axes. Axes.get_yaxis_text1_transform Axes.get_yaxis_text2_transform + Axes.transAxes + Axes.transScale + Axes.transLimits Axes.transData From 4555ab202d166418768b92f9fb9fc513a3ef17dd Mon Sep 17 00:00:00 2001 From: AnanasClassic <114666468+AnanasClassic@users.noreply.github.com> Date: Sun, 21 May 2023 23:04:39 +0300 Subject: [PATCH 5/7] add transXYZ properties --- lib/matplotlib/axes/_base.py | 63 +++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index c08cf2c715bd..3ae2ada1fab1 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -561,11 +561,64 @@ class _AxesBase(martist.Artist): _subclass_uses_cla = False - transData = None # Transform object - """ - a transformation object that converts data coordinates into a - coordinate system used to display data on graph axes - """ + @property + def transAxes(self): + """ + Transform object that represents a coordinate system relative + to the axes of a plot. It provides a mapping from coordinates specified + as fractions of the axes' dimensions. The origin of this coordinate + system (0, 0) is located at the bottom-left corner of the axes, while the + top-right corner is represented by the coordinates (1, 1). + """ + return self._transAxes + + @transAxes.setter + def transAxes(self, value): + self._transAxes = value + + @property + def transScale(self): + """ + Transform object that represents the scaling transformation for + the data coordinates within an axes. It is responsible for converting + the data coordinates to scaled coordinates used for rendering the plot. + The transformation incorporates the scaling applied to the data + along both the x-axis and the y-axis. + """ + return self._transScale + + @transScale.setter + def transScale(self, value): + self._transScale = value + + @property + def transLimits(self): + """ + Transform object that represents the transformation from data + coordinates to the coordinate system used for drawing within the axes + limits. It maps the range of data coordinates to the corresponding range + of the axes limits, taking into account any data clipping that might occur. + """ + return self._transLimits + + @transLimits.setter + def transLimits(self, value): + self._transLimits = value + + @property + def transData(self): + """ + Transform object that represents the transformation from data + coordinates to the coordinate system used for drawing within the axes. + It converts the data coordinates of a plot to the corresponding coordinate + values in the drawing space, enabling proper rendering of plot elements + relative to the axes and the figure. + """ + return self._transData + + @transData.setter + def transData(self, value): + self._transData = value @property def _axis_map(self): From 92eae9eb8e44af34a76667c2b9787f958eb50ccc Mon Sep 17 00:00:00 2001 From: AnanasClassic <114666468+AnanasClassic@users.noreply.github.com> Date: Sun, 21 May 2023 23:08:11 +0300 Subject: [PATCH 6/7] add getters and setters for transXYZ attributes --- lib/matplotlib/axes/_base.pyi | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/axes/_base.pyi b/lib/matplotlib/axes/_base.pyi index 4018d2a97f58..37f5e80aaf23 100644 --- a/lib/matplotlib/axes/_base.pyi +++ b/lib/matplotlib/axes/_base.pyi @@ -46,9 +46,10 @@ class _AxesBase(martist.Artist): yaxis: YAxis bbox: Bbox dataLim: Bbox - transAxes: Transform - transScale: Transform - transLimits: Transform + _transAxes: Transform + _transScale: Transform + _transLimits: Transform + _transData: Transform ignore_existing_data_limits: bool axison: bool _projection_init: Any @@ -67,6 +68,22 @@ class _AxesBase(martist.Artist): box_aspect: float | None = ..., **kwargs ) -> None: ... + @property + def transAxes(self) -> Transform: ... + @transAxes.setter + def transAxes(self, value: Transform) -> None: ... + @property + def transScale(self) -> Transform: ... + @transScale.setter + def transScale(self, value: Transform) -> None: ... + @property + def transLimits(self) -> Transform: ... + @transLimits.setter + def transLimits(self, value: Transform) -> None: ... + @property + def transData(self) -> Transform: ... + @transData.setter + def transData(self, value: Transform) -> None: ... def get_subplotspec(self) -> SubplotSpec | None: ... def set_subplotspec(self, subplotspec: SubplotSpec) -> None: ... def get_gridspec(self) -> GridSpec | None: ... From 5846b5eef275d2d05ce889849e774cbf8a84efe9 Mon Sep 17 00:00:00 2001 From: AnanasClassic <114666468+AnanasClassic@users.noreply.github.com> Date: Sun, 21 May 2023 23:53:12 +0300 Subject: [PATCH 7/7] update adding transXYZ attributes (fix codestyle) --- lib/matplotlib/axes/_base.py | 70 ++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 3ae2ada1fab1..2d0ae11741f4 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -563,62 +563,62 @@ class _AxesBase(martist.Artist): @property def transAxes(self): - """ - Transform object that represents a coordinate system relative - to the axes of a plot. It provides a mapping from coordinates specified - as fractions of the axes' dimensions. The origin of this coordinate - system (0, 0) is located at the bottom-left corner of the axes, while the - top-right corner is represented by the coordinates (1, 1). - """ - return self._transAxes + """ + Transform object that represents a coordinate system relative + to the axes of a plot. It provides a mapping from coordinates specified + as fractions of the axes' dimensions. The origin of this coordinate + system (0, 0) is located at the bottom-left corner of the axes, while the + top-right corner is represented by the coordinates (1, 1). + """ + return self._transAxes @transAxes.setter def transAxes(self, value): - self._transAxes = value + self._transAxes = value @property def transScale(self): - """ - Transform object that represents the scaling transformation for - the data coordinates within an axes. It is responsible for converting - the data coordinates to scaled coordinates used for rendering the plot. - The transformation incorporates the scaling applied to the data - along both the x-axis and the y-axis. - """ - return self._transScale + """ + Transform object that represents the scaling transformation for + the data coordinates within an axes. It is responsible for converting + the data coordinates to scaled coordinates used for rendering the plot. + The transformation incorporates the scaling applied to the data + along both the x-axis and the y-axis. + """ + return self._transScale @transScale.setter def transScale(self, value): - self._transScale = value + self._transScale = value @property def transLimits(self): - """ - Transform object that represents the transformation from data - coordinates to the coordinate system used for drawing within the axes - limits. It maps the range of data coordinates to the corresponding range - of the axes limits, taking into account any data clipping that might occur. - """ - return self._transLimits + """ + Transform object that represents the transformation from data + coordinates to the coordinate system used for drawing within the axes + limits. It maps the range of data coordinates to the corresponding range + of the axes limits, taking into account any data clipping that might occur. + """ + return self._transLimits @transLimits.setter def transLimits(self, value): - self._transLimits = value + self._transLimits = value @property def transData(self): - """ - Transform object that represents the transformation from data - coordinates to the coordinate system used for drawing within the axes. - It converts the data coordinates of a plot to the corresponding coordinate - values in the drawing space, enabling proper rendering of plot elements - relative to the axes and the figure. - """ - return self._transData + """ + Transform object that represents the transformation from data + coordinates to the coordinate system used for drawing within the axes. + It converts the data coordinates of a plot to the corresponding coordinate + values in the drawing space, enabling proper rendering of plot elements + relative to the axes and the figure. + """ + return self._transData @transData.setter def transData(self, value): - self._transData = value + self._transData = value @property def _axis_map(self):