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

Skip to content

Commit 66c46c7

Browse files
QuLogicanntzer
authored andcommitted
Add fancy repr to geographic transforms.
1 parent 862909c commit 66c46c7

1 file changed

Lines changed: 41 additions & 2 deletions

File tree

  • lib/matplotlib/projections

lib/matplotlib/projections/geo.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
import matplotlib.spines as mspines
1818
import matplotlib.axis as maxis
1919
from matplotlib.ticker import Formatter, Locator, NullLocator, FixedLocator, NullFormatter
20-
from matplotlib.transforms import Affine2D, Affine2DBase, Bbox, \
21-
BboxTransformTo, IdentityTransform, Transform, TransformWrapper
20+
from matplotlib.transforms import Affine2D, BboxTransformTo, Transform
2221

2322
class GeoAxes(Axes):
2423
"""
@@ -268,6 +267,11 @@ def __init__(self, resolution):
268267
Transform.__init__(self)
269268
self._resolution = resolution
270269

270+
def __str__(self):
271+
return "{}({})".format(type(self).__name__, self._resolution)
272+
273+
__repr__ = __str__
274+
271275
def transform_non_affine(self, ll):
272276
longitude = ll[:, 0:1]
273277
latitude = ll[:, 1:2]
@@ -308,6 +312,11 @@ def __init__(self, resolution):
308312
Transform.__init__(self)
309313
self._resolution = resolution
310314

315+
def __str__(self):
316+
return "{}({})".format(type(self).__name__, self._resolution)
317+
318+
__repr__ = __str__
319+
311320
def transform_non_affine(self, xy):
312321
# MGDTODO: Math is hard ;(
313322
return xy
@@ -347,6 +356,11 @@ def __init__(self, resolution):
347356
Transform.__init__(self)
348357
self._resolution = resolution
349358

359+
def __str__(self):
360+
return "{}({})".format(type(self).__name__, self._resolution)
361+
362+
__repr__ = __str__
363+
350364
def transform_non_affine(self, ll):
351365
longitude = ll[:, 0:1]
352366
latitude = ll[:, 1:2]
@@ -381,6 +395,11 @@ def __init__(self, resolution):
381395
Transform.__init__(self)
382396
self._resolution = resolution
383397

398+
def __str__(self):
399+
return "{}({})".format(type(self).__name__, self._resolution)
400+
401+
__repr__ = __str__
402+
384403
def transform_non_affine(self, xy):
385404
x, y = xy.T
386405
z = np.sqrt(1 - (x / 4) ** 2 - (y / 2) ** 2)
@@ -423,6 +442,11 @@ def __init__(self, resolution):
423442
Transform.__init__(self)
424443
self._resolution = resolution
425444

445+
def __str__(self):
446+
return "{}({})".format(type(self).__name__, self._resolution)
447+
448+
__repr__ = __str__
449+
426450
def transform_non_affine(self, ll):
427451
def d(theta):
428452
delta = -(theta + np.sin(theta) - pi_sin_l) / (1 + np.cos(theta))
@@ -476,6 +500,11 @@ def __init__(self, resolution):
476500
Transform.__init__(self)
477501
self._resolution = resolution
478502

503+
def __str__(self):
504+
return "{}({})".format(type(self).__name__, self._resolution)
505+
506+
__repr__ = __str__
507+
479508
def transform_non_affine(self, xy):
480509
x = xy[:, 0:1]
481510
y = xy[:, 1:2]
@@ -525,6 +554,11 @@ def __init__(self, center_longitude, center_latitude, resolution):
525554
self._center_longitude = center_longitude
526555
self._center_latitude = center_latitude
527556

557+
def __str__(self):
558+
return "{}({})".format(type(self).__name__, self._resolution)
559+
560+
__repr__ = __str__
561+
528562
def transform_non_affine(self, ll):
529563
longitude = ll[:, 0:1]
530564
latitude = ll[:, 1:2]
@@ -572,6 +606,11 @@ def __init__(self, center_longitude, center_latitude, resolution):
572606
self._center_longitude = center_longitude
573607
self._center_latitude = center_latitude
574608

609+
def __str__(self):
610+
return "{}({})".format(type(self).__name__, self._resolution)
611+
612+
__repr__ = __str__
613+
575614
def transform_non_affine(self, xy):
576615
x = xy[:, 0:1]
577616
y = xy[:, 1:2]

0 commit comments

Comments
 (0)