Browse files import warnings, and make imports absolute

The lack of "import warnings" was an error.
In addition to fixing that, I tried to make the import
scheme more orderly, and to use absolute imports.
  • Loading branch information...
1 parent 8ab4318 commit d4e9dfc2924b5a898d94556a0499d808fceaa85f @efiring committed Aug 21, 2012
Showing with 27 additions and 22 deletions.
  1. +27 −22 lib/matplotlib/
@@ -12,28 +12,33 @@
from __future__ import print_function
+import warnings
+from operator import itemgetter
import numpy as np
-import artist
-from artist import Artist, allow_rasterization
-from axes import Axes, SubplotBase, subplot_class_factory
-from cbook import allequal, Stack, iterable
-from matplotlib import _image
-import colorbar as cbar
-from image import FigureImage
-from matplotlib import rcParams
-from patches import Rectangle
-from text import Text, _process_text_args
-from legend import Legend
-from transforms import Affine2D, Bbox, BboxTransformTo, TransformedBbox
-from projections import get_projection_names, process_projection_requirements
-from matplotlib.blocking_input import BlockingMouseInput, BlockingKeyMouseInput
+from matplotlib import rcParams, docstring
+import matplotlib.artist as martist
+from matplotlib.artist import Artist, allow_rasterization
import matplotlib.cbook as cbook
-from matplotlib import docstring
+from matplotlib.cbook import Stack, iterable
-from operator import itemgetter
+from matplotlib import _image
+from matplotlib.image import FigureImage
+import matplotlib.colorbar as cbar
+from matplotlib.axes import Axes, SubplotBase, subplot_class_factory
+from matplotlib.blocking_input import BlockingMouseInput, BlockingKeyMouseInput
+from matplotlib.legend import Legend
+from matplotlib.patches import Rectangle
+from matplotlib.projections import (get_projection_names,
+ process_projection_requirements)
+from matplotlib.text import Text, _process_text_args
+from matplotlib.transforms import (Affine2D, Bbox, BboxTransformTo,
+ TransformedBbox)
docstring.interpd.update(projection_names = get_projection_names())
@@ -918,7 +923,7 @@ def draw(self, renderer):
not_composite = self.suppressComposite
if len(self.images)<=1 or not_composite or \
- not allequal([im.origin for im in self.images]):
+ not cbook.allequal([im.origin for im in self.images]):
for a in self.images:
dsu.append( (a.get_zorder(), a, a.draw, [renderer]))
@@ -1113,7 +1118,7 @@ def gca(self, **kwargs):
The following kwargs are supported for ensuring the returned axes
adheres to the given projection etc., and for axes creation if
the active axes does not exist:
@@ -1135,7 +1140,7 @@ def gca(self, **kwargs):
kwargs_copy = kwargs.copy()
projection_class, _, key = \
process_projection_requirements(self, **kwargs_copy)
# let the returned axes have any gridspec by removing it from the key
ckey = ckey[1:]
key = key[1:]
@@ -1144,7 +1149,7 @@ def gca(self, **kwargs):
# continue and a new axes will be created
if key == ckey and isinstance(cax, projection_class):
return cax
# no axes found, so create one which spans the figure
return self.add_subplot(1, 1, 1, **kwargs)
@@ -1497,4 +1502,4 @@ def figaspect(arg):
newsize = np.clip(newsize,figsize_min,figsize_max)
return newsize

0 comments on commit d4e9dfc

Please sign in to comment.