We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c60c58 commit 33a9d9aCopy full SHA for 33a9d9a
lib/matplotlib/projections/geo.py
@@ -476,8 +476,16 @@ def __init__(self, resolution):
476
self._resolution = resolution
477
478
def transform_non_affine(self, xy):
479
- # MGDTODO: Math is hard ;(
480
- return xy
+ x = xy[:, 0:1]
+ y = xy[:, 1:2]
481
+
482
+ # from Equations (7, 8) of
483
+ # http://mathworld.wolfram.com/MollweideProjection.html
484
+ theta = np.arcsin(y / np.sqrt(2))
485
+ lon = (np.pi / (2 * np.sqrt(2))) * x / np.cos(theta)
486
+ lat = np.arcsin((2 * theta + np.sin(2 * theta)) / np.pi)
487
488
+ return np.concatenate((lon, lat), 1)
489
transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__
490
491
def inverted(self):
0 commit comments