1
1
from __future__ import unicode_literals
2
2
3
+ import matplotlib
3
4
from matplotlib .axes import Axes
4
5
from matplotlib .patches import Circle
5
6
from matplotlib .path import Path
@@ -405,14 +406,6 @@ def transform_non_affine(self, ll):
405
406
y = (sqrt2 * np .sin (latitude )) / alpha
406
407
return np .concatenate ((x , y ), 1 )
407
408
408
- # Note: For compatibility with matplotlib v1.1 and older, you'll need
409
- # to explicitly implement a ``transform`` method as well. Otherwise a
410
- # ``NotImplementedError`` will be raised. This isn't necessary for v1.2
411
- # and newer, however.
412
- def transform (self , values ):
413
- return self .transform_affine (self .transform_non_affine (values ))
414
- transform .__doc__ = Transform .transform .__doc__
415
-
416
409
# This is where things get interesting. With this projection,
417
410
# straight lines in data space become curves in display space.
418
411
# This is done by interpolating new values between the input
@@ -426,11 +419,19 @@ def transform_path_non_affine(self, path):
426
419
transform_path_non_affine .__doc__ = \
427
420
Transform .transform_path_non_affine .__doc__
428
421
429
- # Once again, for compatibility with matplotlib v1.1 and older, we need
430
- # to explicitly override ``transform_path``. With v1.2 and newer, only
431
- # overriding the ``transform_path_non_affine`` method is sufficient.
432
- transform_path = transform_path_non_affine
433
- transform_path .__doc__ = Transform .transform_path .__doc__
422
+ if matplotlib .__version__ < '1.2' :
423
+ # Note: For compatibility with matplotlib v1.1 and older, you'll
424
+ # need to explicitly implement a ``transform`` method as well.
425
+ # Otherwise a ``NotImplementedError`` will be raised. This isn't
426
+ # necessary for v1.2 and newer, however.
427
+ transform = transform_non_affine
428
+
429
+ # Similarly, we need to explicitly override ``transform_path`` if
430
+ # compatibility with older matplotlib versions is needed. With v1.2
431
+ # and newer, only overriding the ``transform_path_non_affine``
432
+ # method is sufficient.
433
+ transform_path = transform_path_non_affine
434
+ transform_path .__doc__ = Transform .transform_path .__doc__
434
435
435
436
def inverted (self ):
436
437
return HammerAxes .InvertedHammerTransform ()
@@ -455,7 +456,8 @@ def transform_non_affine(self, xy):
455
456
456
457
# As before, we need to implement the "transform" method for
457
458
# compatibility with matplotlib v1.1 and older.
458
- transform = transform_non_affine
459
+ if matplotlib .__version__ < '1.2' :
460
+ transform = transform_non_affine
459
461
460
462
def inverted (self ):
461
463
# The inverse of the inverse is the original transform... ;)
0 commit comments