8000 Add PEP8-compliant aliases to transAxes, transData, etc. · matplotlib/matplotlib@33259df · GitHub
[go: up one dir, main page]

Skip to content

Commit 33259df

Browse files
committed
Add PEP8-compliant aliases to transAxes, transData, etc.
ax.transAxes / transData / etc. are perhaps one of the most user-facing parts of mpl that are not pep8 compliant. Provide some PEP8-compliant aliases for those (like myself) who are excessively (and unduly?) bothered by that. Note that (quite unusually for myself :-)) I am **not** proposing to deprecate the camelCase names.
1 parent 90437e4 commit 33259df

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PEP8-compliant ``trans_axes``, etc. aliases to ``transAxes``, etc.
2+
------------------------------------------------------------------
3+
4+
The ``Axes.transAxes``, ``transScale``, ``transLimits``, and ``transData``
5+
attributes can now also be accessed under the names ``trans_axes``,
6+
``trans_scale``, ``trans_limits``, and ``trans_data``.

lib/matplotlib/axes/_base.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,38 @@ def _set_lim_and_transforms(self):
659659
self._yaxis_transform = mtransforms.blended_transform_factory(
660660
self.transAxes, self.transData)
661661

662+
@property
663+
def trans_axes(self):
664+
return self.transAxes
665+
666+
@trans_axes.setter
667+
def trans_axes(self, value):
668+
self.transAxes = value
669+
670+
@property
671+
def trans_scale(self):
672+
return self.transScale
673+
674+
@trans_scale.setter
675+
def trans_scale(self, value):
676+
self.transScale = value
677+
678+
@property
679+
def trans_limits(self):
680+
return self.transLimits
681+
682+
@trans_limits.setter
683+
def trans_limits(self, value):
684+
self.transLimits = value
685+
686+
@property
687+
def trans_data(self):
688+
return self.transData
689+
690+
@trans_data.setter
691+
def trans_data(self, value):
692+
self.transData = value
693+
662694
def get_xaxis_transform(self, which='grid'):
663695
"""
664696
Get the transformation used for drawing x-axis labels, ticks

0 commit comments

Comments
 (0)
0