From: <md...@us...> - 2009-07-06 19:43:06
|
Revision: 7248 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7248&view=rev Author: mdboom Date: 2009-07-06 19:43:00 +0000 (Mon, 06 Jul 2009) Log Message: ----------- [2687673] Fix problems with Mollweide projection, enable it, and add to geo_demo.py Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/geo_demo.py trunk/matplotlib/lib/matplotlib/projections/__init__.py trunk/matplotlib/lib/matplotlib/projections/geo.py Modified: trunk/matplotlib/examples/pylab_examples/geo_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/geo_demo.py 2009-07-03 19:35:35 UTC (rev 7247) +++ trunk/matplotlib/examples/pylab_examples/geo_demo.py 2009-07-06 19:43:00 UTC (rev 7248) @@ -4,13 +4,19 @@ from pylab import * subplot(221, projection="aitoff") +title("Aitoff") grid(True) subplot(222, projection="hammer") +title("Hammer") grid(True) subplot(223, projection="lambert") +title("Lambert") grid(True) +subplot(224, projection="mollweide") +title("Mollweide") +grid(True) show() Modified: trunk/matplotlib/lib/matplotlib/projections/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/projections/__init__.py 2009-07-03 19:35:35 UTC (rev 7247) +++ trunk/matplotlib/lib/matplotlib/projections/__init__.py 2009-07-06 19:43:00 UTC (rev 7248) @@ -1,4 +1,4 @@ -from geo import AitoffAxes, HammerAxes, LambertAxes +from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes from polar import PolarAxes from matplotlib import axes @@ -38,7 +38,8 @@ PolarAxes, AitoffAxes, HammerAxes, - LambertAxes) + LambertAxes, + MollweideAxes) def register_projection(cls): Modified: trunk/matplotlib/lib/matplotlib/projections/geo.py =================================================================== --- trunk/matplotlib/lib/matplotlib/projections/geo.py 2009-07-03 19:35:35 UTC (rev 7247) +++ trunk/matplotlib/lib/matplotlib/projections/geo.py 2009-07-06 19:43:00 UTC (rev 7248) @@ -422,10 +422,21 @@ self._resolution = resolution def transform(self, ll): + def d(theta): + delta = -(theta + np.sin(theta) - pi_sin_l) / (1 + np.cos(theta)) + return delta, delta > 0.001 + longitude = ll[:, 0:1] latitude = ll[:, 1:2] - aux = 2.0 * np.arcsin((2.0 * latitude) / np.pi) + pi_sin_l = np.pi * np.sin(latitude) + theta = 2.0 * latitude + delta, large_delta = d(theta) + while np.any(large_delta): + theta += np.where(large_delta, delta, 0) + delta, large_delta = d(theta) + aux = theta / 2 + x = (2.0 * np.sqrt(2.0) * longitude * np.cos(aux)) / np.pi y = (np.sqrt(2.0) * np.sin(aux)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |