Revision: 3938
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3938&view=rev
Author: mdboom
Date: 2007-10-12 07:29:57 -0700 (Fri, 12 Oct 2007)
Log Message:
-----------
Forgot the __init__.py
Added Paths:
-----------
branches/transforms/lib/matplotlib/projections/__init__.py
Added: branches/transforms/lib/matplotlib/projections/__init__.py
===================================================================
--- branches/transforms/lib/matplotlib/projections/__init__.py
(rev 0)
+++ branches/transforms/lib/matplotlib/projections/__init__.py 2007-10-12
14:29:57 UTC (rev 3938)
@@ -0,0 +1,39 @@
+from polar import PolarAxes
+from matplotlib import axes
+
+class ProjectionRegistry(object):
+ def __init__(self):
+ self._all_projection_types = {}
+
+ def register(self, *projections):
+ for projection in projections:
+ name = projection.name
+ self._all_projection_types[name] = projection
+
+ def get_projection_class(self, name):
+ return self._all_projection_types[name]
+
+ def get_projection_names(self):
+ names = self._all_projection_types.keys()
+ names.sort()
+ return names
+projection_registry = ProjectionRegistry()
+
+projection_registry.register(
+ axes.Axes,
+ PolarAxes)
+
+def get_projection_class(projection):
+ if projection is None:
+ projection = 'rectilinear'
+
+ try:
+ return projection_registry.get_projection_class(projection)
+ except KeyError:
+ raise ValueError("Unknown projection '%s'" % projection)
+
+def projection_factory(projection, figure, rect, **kwargs):
+ return get_projection_class(projection)(figure, rect, **kwargs)
+
+def get_projection_names():
+ return projection_registry.get_projection_names()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins