Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

figure.py: import warnings, and make imports absolute #1133

Merged
merged 1 commit into from Aug 21, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 27 additions & 22 deletions lib/matplotlib/figure.py
Expand Up @@ -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())
Expand Down Expand Up @@ -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]))
else:
Expand Down Expand Up @@ -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:

%(Axes)s

"""
Expand All @@ -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:]
Expand All @@ -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)

Expand Down Expand Up @@ -1497,4 +1502,4 @@ def figaspect(arg):
newsize = np.clip(newsize,figsize_min,figsize_max)
return newsize

docstring.interpd.update(Figure=artist.kwdoc(Figure))
docstring.interpd.update(Figure=martist.kwdoc(Figure))