From c9d2210cfde65fc962de96fea2b761c51f21fb9f Mon Sep 17 00:00:00 2001 From: Phil Elson Date: Tue, 28 Feb 2012 09:26:50 +0000 Subject: [PATCH] Misc doc changes applied to the maintenance branch. --- doc/api/sankey_api.rst | 2 +- doc/devel/gitwash/git_links.inc | 28 ++-- doc/faq/installing_faq.rst | 2 +- doc/users/intro.rst | 2 +- doc/users/transforms_tutorial.rst | 1 + examples/api/demo_affine_image.py | 4 +- examples/event_handling/lasso_demo.py | 1 - lib/matplotlib/__init__.py | 24 +-- lib/matplotlib/axes.py | 189 +++++++++++++---------- lib/matplotlib/axis.py | 4 +- lib/matplotlib/backends/backend_svg.py | 2 +- lib/matplotlib/image.py | 72 ++++----- lib/matplotlib/patches.py | 2 +- lib/matplotlib/path.py | 11 +- lib/matplotlib/projections/polar.py | 1 - lib/matplotlib/sankey.py | 21 +-- lib/matplotlib/text.py | 3 + lib/matplotlib/ticker.py | 2 +- lib/matplotlib/tight_bbox.py | 2 +- lib/matplotlib/transforms.py | 17 +- lib/mpl_toolkits/axisartist/axislines.py | 2 +- 21 files changed, 204 insertions(+), 188 deletions(-) diff --git a/doc/api/sankey_api.rst b/doc/api/sankey_api.rst index 40271721dd7b..51bdb15fa5f4 100644 --- a/doc/api/sankey_api.rst +++ b/doc/api/sankey_api.rst @@ -4,7 +4,7 @@ sankey :mod:`matplotlib.sankey` -======================= +======================== .. automodule:: matplotlib.sankey :members: diff --git a/doc/devel/gitwash/git_links.inc b/doc/devel/gitwash/git_links.inc index a679f2d78a36..5b769eccb6fb 100644 --- a/doc/devel/gitwash/git_links.inc +++ b/doc/devel/gitwash/git_links.inc @@ -20,26 +20,26 @@ .. _git svn crash course: http://git-scm.com/course/svn.html .. _learn.github: http://learn.github.com/ .. _network graph visualizer: http://github.com/blog/39-say-hello-to-the-network-graph-visualizer -.. _git user manual: http://www.kernel.org/pub/software/scm/git/docs/user-manual.html -.. _git tutorial: http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html +.. _git user manual: http://schacon.github.com/git/user-manual.html +.. _git tutorial: http://schacon.github.com/git/gittutorial.html .. _git community book: http://book.git-scm.com/ .. _git ready: http://www.gitready.com/ .. _git casts: http://www.gitcasts.com/ .. _Fernando's git page: http://www.fperez.org/py4science/git.html .. _git magic: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html .. _git concepts: http://www.eecs.harvard.edu/~cduan/technical/git/ -.. _git clone: http://www.kernel.org/pub/software/scm/git/docs/git-clone.html -.. _git checkout: http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html -.. _git commit: http://www.kernel.org/pub/software/scm/git/docs/git-commit.html -.. _git push: http://www.kernel.org/pub/software/scm/git/docs/git-push.html -.. _git pull: http://www.kernel.org/pub/software/scm/git/docs/git-pull.html -.. _git add: http://www.kernel.org/pub/software/scm/git/docs/git-add.html -.. _git status: http://www.kernel.org/pub/software/scm/git/docs/git-status.html -.. _git diff: http://www.kernel.org/pub/software/scm/git/docs/git-diff.html -.. _git log: http://www.kernel.org/pub/software/scm/git/docs/git-log.html -.. _git branch: http://www.kernel.org/pub/software/scm/git/docs/git-branch.html -.. _git remote: http://www.kernel.org/pub/software/scm/git/docs/git-remote.html -.. _git config: http://www.kernel.org/pub/software/scm/git/docs/git-config.html +.. _git clone: http://schacon.github.com/git/git-clone.html +.. _git checkout: http://schacon.github.com/git/git-checkout.html +.. _git commit: http://schacon.github.com/git/git-commit.html +.. _git push: http://schacon.github.com/git/git-push.html +.. _git pull: http://schacon.github.com/git/git-pull.html +.. _git add: http://schacon.github.com/git/git-add.html +.. _git status: http://schacon.github.com/git/git-status.html +.. _git diff: http://schacon.github.com/git/git-diff.html +.. _git log: http://schacon.github.com/git/git-log.html +.. _git branch: http://schacon.github.com/git/git-branch.html +.. _git remote: http://schacon.github.com/git/git-remote.html +.. _git config: http://schacon.github.com/git/git-config.html .. _why the -a flag?: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html .. _git staging area: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html .. _tangled working copy problem: http://tomayko.com/writings/the-thing-about-git diff --git a/doc/faq/installing_faq.rst b/doc/faq/installing_faq.rst index 25f0fb833d8a..91bd3b30ed43 100644 --- a/doc/faq/installing_faq.rst +++ b/doc/faq/installing_faq.rst @@ -366,4 +366,4 @@ a single click installer. * The Enthought Python Distribution `EPD `_ -* `python (x, y) `_ +* `python (x, y) `_ diff --git a/doc/users/intro.rst b/doc/users/intro.rst index 9e850bd5e94b..dc7a8df3d43b 100644 --- a/doc/users/intro.rst +++ b/doc/users/intro.rst @@ -70,7 +70,7 @@ nothing about output. The *backends* are device dependent drawing devices, aka renderers, that transform the frontend representation to hardcopy or a display device (:ref:`what-is-a-backend`). Example backends: PS creates `PostScript® -`_ hardcopy, SVG +`_ hardcopy, SVG creates `Scalable Vector Graphics `_ hardcopy, Agg creates PNG output using the high quality `Anti-Grain Geometry `_ library that ships with diff --git a/doc/users/transforms_tutorial.rst b/doc/users/transforms_tutorial.rst index 794c4bcd8e3f..7c77c8cb8565 100644 --- a/doc/users/transforms_tutorial.rst +++ b/doc/users/transforms_tutorial.rst @@ -112,6 +112,7 @@ documentation figure size defaults are different. .. note:: + If you run the source code in the example above in a GUI backend, you may also find that the two arrows for the `data` and `display` annotations do not point to exactly the same point. This is because diff --git a/examples/api/demo_affine_image.py b/examples/api/demo_affine_image.py index f95f0d12a11c..68e416fbfd29 100644 --- a/examples/api/demo_affine_image.py +++ b/examples/api/demo_affine_image.py @@ -35,7 +35,7 @@ def imshow_affine(ax, z, *kl, **kwargs): ax1 = plt.subplot(121) Z = get_image() - im1 = imshow_affine(ax1, Z, interpolation='nearest', cmap=cm.jet, + im1 = imshow_affine(ax1, Z, interpolation='none', cmap=cm.jet, origin='lower', extent=[-2, 4, -3, 2], clip_on=True) @@ -56,7 +56,7 @@ def imshow_affine(ax, z, *kl, **kwargs): # image skew ax2 = plt.subplot(122) - im2 = ax2.imshow(Z, interpolation='nearest', cmap=cm.jet, + im2 = ax2.imshow(Z, interpolation='none', cmap=cm.jet, origin='lower', extent=[-2, 4, -3, 2], clip_on=True) im2._image_skew_coordinate = (3, -2) diff --git a/examples/event_handling/lasso_demo.py b/examples/event_handling/lasso_demo.py index 90d5b97273ad..d441a203fa3f 100644 --- a/examples/event_handling/lasso_demo.py +++ b/examples/event_handling/lasso_demo.py @@ -8,7 +8,6 @@ inside polygon detection routine. """ from matplotlib.widgets import Lasso -import matplotlib.mlab from matplotlib.nxutils import points_inside_poly from matplotlib.colors import colorConverter from matplotlib.collections import RegularPolyCollection diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 8f813a37d7b6..4b102fb38be3 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -902,14 +902,20 @@ def use(arg, warn=True): will specify a default of pdf output generated by Cairo. - Note: this function must be called *before* importing pylab for - the first time; or, if you are not using pylab, it must be called - before importing matplotlib.backends. If warn is True, a warning - is issued if you try and callthis after pylab or pyplot have been - loaded. In certain black magic use cases, eg - pyplot.switch_backends, we are doing the reloading necessary to - make the backend switch work (in some cases, eg pure image - backends) so one can set warn=False to supporess the warnings + .. note:: + + This function must be called *before* importing pyplot for + the first time; or, if you are not using pyplot, it must be called + before importing matplotlib.backends. If warn is True, a warning + is issued if you try and call this after pylab or pyplot have been + loaded. In certain black magic use cases, e.g. + :func:`pyplot.switch_backends`, we are doing the reloading necessary to + make the backend switch work (in some cases, e.g. pure image + backends) so one can set warn=False to supporess the warnings. + + To find out which backend is currently set, see + :func:`matplotlib.get_backend`. + """ if 'matplotlib.backends' in sys.modules: if warn: warnings.warn(_use_error_msg) @@ -929,7 +935,7 @@ def use(arg, warn=True): rcParams['backend'] = name def get_backend(): - "Returns the current backend" + "Returns the current backend." return rcParams['backend'] def interactive(b): diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index a136256ccdc4..e4957f57aeab 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -311,7 +311,6 @@ def _plot_args(self, tup, kwargs): ret.append(seg) return ret - def _grab_next_args(self, *args, **kwargs): remaining = args @@ -334,7 +333,6 @@ def _grab_next_args(self, *args, **kwargs): remaining=remaining[isplit:] - class Axes(martist.Artist): """ The :class:`Axes` contains most of the figure elements: @@ -491,10 +489,10 @@ def __init__(self, fig, rect, self.relim) def get_window_extent(self, *args, **kwargs): - ''' + """ get the axes bounding box in display space; *args* and *kwargs* are empty - ''' + """ return self.bbox def _init_axis(self): @@ -532,12 +530,14 @@ def _set_lim_and_transforms(self): transformations. .. note:: + This method is primarily used by rectilinear projections of the :class:`~matplotlib.axes.Axes` class, and is meant to be overridden by new kinds of projection axes that need different transformations and limits. (See :class:`~matplotlib.projections.polar.PolarAxes` for an example. + """ self.transAxes = mtransforms.BboxTransformTo(self.bbox) @@ -569,10 +569,12 @@ def get_xaxis_transform(self,which='grid'): y-direction is in axis coordinates. .. note:: + This transformation is primarily used by the :class:`~matplotlib.axis.Axis` class, and is meant to be overridden by new kinds of projections that may need to place axis elements in different locations. + """ if which=='grid': return self._xaxis_transform @@ -599,10 +601,12 @@ def get_xaxis_text1_transform(self, pad_points): text. .. note:: + This transformation is primarily used by the :class:`~matplotlib.axis.Axis` class, and is meant to be overridden by new kinds of projections that may need to place axis elements in different locations. + """ return (self.get_xaxis_transform(which='tick1') + mtransforms.ScaledTranslation(0, -1 * pad_points / 72.0, @@ -623,10 +627,12 @@ def get_xaxis_text2_transform(self, pad_points): text. .. note:: + This transformation is primarily used by the :class:`~matplotlib.axis.Axis` class, and is meant to be overridden by new kinds of projections that may need to place axis elements in different locations. + """ return (self.get_xaxis_transform(which='tick2') + mtransforms.ScaledTranslation(0, pad_points / 72.0, @@ -640,10 +646,12 @@ def get_yaxis_transform(self,which='grid'): y-direction is in data coordinates. .. note:: + This transformation is primarily used by the :class:`~matplotlib.axis.Axis` class, and is meant to be overridden by new kinds of projections that may need to place axis elements in different locations. + """ if which=='grid': return self._yaxis_transform @@ -670,10 +678,12 @@ def get_yaxis_text1_transform(self, pad_points): text. .. note:: + This transformation is primarily used by the :class:`~matplotlib.axis.Axis` class, and is meant to be overridden by new kinds of projections that may need to place axis elements in different locations. + """ return (self.get_yaxis_transform(which='tick1') + mtransforms.ScaledTranslation(-1 * pad_points / 72.0, 0, @@ -699,6 +709,7 @@ def get_yaxis_text2_transform(self, pad_points): :class:`~matplotlib.axis.Axis` class, and is meant to be overridden by new kinds of projections that may need to place axis elements in different locations. + """ return (self.get_yaxis_transform(which='tick2') + mtransforms.ScaledTranslation(pad_points / 72.0, 0, @@ -758,7 +769,7 @@ def set_position(self, pos, which='both'): self._originalPosition.set(pos) def reset_position(self): - 'Make the original position the active position' + """Make the original position the active position""" pos = self.get_position(original=True) self.set_position(pos, which='active') @@ -778,7 +789,7 @@ def get_axes_locator(self): return self._axes_locator def _set_artist_props(self, a): - 'set the boilerplate props for artists added to axes' + """set the boilerplate props for artists added to axes""" a.set_figure(self.figure) if not a.is_transform_set(): a.set_transform(self.transData) @@ -795,7 +806,9 @@ def _gen_axes_patch(self): projections it may not be. .. note:: + Intended to be overridden by new projection types. + """ return mpatches.Rectangle((0.0, 0.0), 1.0, 1.0) @@ -809,7 +822,9 @@ def _gen_axes_spines(self, locations=None, offset=0.0, units='inches'): other projections it may not be. .. note:: + Intended to be overridden by new projection types. + """ return { 'left':mspines.Spine.linear_spine(self,'left'), @@ -819,7 +834,7 @@ def _gen_axes_spines(self, locations=None, offset=0.0, units='inches'): } def cla(self): - 'Clear the current axes' + """Clear the current axes""" # Note: this is called by Axes.__init__() self.xaxis.cla() self.yaxis.cla() @@ -912,7 +927,7 @@ def get_frame(self): frame = property(get_frame) def clear(self): - 'clear the axes' + """clear the axes""" self.cla() def set_color_cycle(self, clist): @@ -926,7 +941,7 @@ def set_color_cycle(self, clist): def ishold(self): - 'return the HOLD status of the axes' + """return the HOLD status of the axes""" return self._hold def hold(self, b=None): @@ -1090,10 +1105,10 @@ def get_data_ratio_log(self): def apply_aspect(self, position=None): - ''' + """ Use :meth:`_aspect` and :meth:`_adjustable` to modify the axes box or the view limits. - ''' + """ if position is None: position = self.get_position(original=True) @@ -1237,14 +1252,14 @@ def apply_aspect(self, position=None): #print 'New xsize, ysize/xsize', x1-x0, ysize/(x1-x0) def axis(self, *v, **kwargs): - ''' + """ Convenience method for manipulating the x and y view limits and the aspect ratio of the plot. For details, see :func:`~matplotlib.pyplot.axis`. *kwargs* are passed on to :meth:`set_xlim` and :meth:`set_ylim` - ''' + """ if len(v) == 0 and len(kwargs) == 0: xmin, xmax = self.get_xlim() ymin, ymax = self.get_ylim() @@ -1316,46 +1331,46 @@ def get_child_artists(self): raise DeprecationWarning('Use get_children instead') def get_frame(self): - 'Return the axes Rectangle frame' + """Return the axes Rectangle frame""" warnings.warn('use ax.patch instead', DeprecationWarning) return self.patch def get_legend(self): - 'Return the legend.Legend instance, or None if no legend is defined' + """Return the legend.Legend instance, or None if no legend is defined""" return self.legend_ def get_images(self): - 'return a list of Axes images contained by the Axes' + """return a list of Axes images contained by the Axes""" return cbook.silent_list('AxesImage', self.images) def get_lines(self): - 'Return a list of lines contained by the Axes' + """Return a list of lines contained by the Axes""" return cbook.silent_list('Line2D', self.lines) def get_xaxis(self): - 'Return the XAxis instance' + """Return the XAxis instance""" return self.xaxis def get_xgridlines(self): - 'Get the x grid lines as a list of Line2D instances' + """Get the x grid lines as a list of Line2D instances""" return cbook.silent_list('Line2D xgridline', self.xaxis.get_gridlines()) def get_xticklines(self): - 'Get the xtick lines as a list of Line2D instances' + """Get the xtick lines as a list of Line2D instances""" return cbook.silent_list('Text xtickline', self.xaxis.get_ticklines()) def get_yaxis(self): - 'Return the YAxis instance' + """Return the YAxis instance""" return self.yaxis def get_ygridlines(self): - 'Get the y grid lines as a list of Line2D instances' + """Get the y grid lines as a list of Line2D instances""" return cbook.silent_list('Line2D ygridline', self.yaxis.get_gridlines()) def get_yticklines(self): - 'Get the ytick lines as a list of Line2D instances' + """Get the ytick lines as a list of Line2D instances""" return cbook.silent_list('Line2D ytickline', self.yaxis.get_ticklines()) #### Adding and tracking artists @@ -1376,18 +1391,19 @@ def _sci(self, im): def _gci(self): """ - helper for :func:`~matplotlib.pyplot.gci`; + Helper for :func:`~matplotlib.pyplot.gci`; do not use elsewhere. """ return self._current_image def has_data(self): - '''Return *True* if any artists have been added to axes. + """ + Return *True* if any artists have been added to axes. This should not be used to determine whether the *dataLim* need to be updated, and may not actually be useful for anything. - ''' + """ return ( len(self.collections) + len(self.images) + @@ -1395,11 +1411,11 @@ def has_data(self): len(self.patches))>0 def add_artist(self, a): - ''' + """ Add any :class:`~matplotlib.artist.Artist` to the axes. Returns the artist. - ''' + """ a.set_axes(self) self.artists.append(a) self._set_artist_props(a) @@ -1408,12 +1424,12 @@ def add_artist(self, a): return a def add_collection(self, collection, autolim=True): - ''' + """ Add a :class:`~matplotlib.collections.Collection` instance to the axes. Returns the collection. - ''' + """ label = collection.get_label() if not label: collection.set_label('_collection%d'%len(self.collections)) @@ -1430,12 +1446,12 @@ def add_collection(self, collection, autolim=True): return collection def add_line(self, line): - ''' + """ Add a :class:`~matplotlib.lines.Line2D` to the list of plot lines Returns the line. - ''' + """ self._set_artist_props(line) if line.get_clip_path() is None: line.set_clip_path(self.patch) @@ -1474,7 +1490,7 @@ def add_patch(self, p): return p def _update_patch_limits(self, patch): - 'update the data limits for patch *p*' + """update the data limits for patch *p*""" # hist can add zero height Rectangles, which is useful to keep # the bins, counts and patches lined up, but it throws off log # scaling. We'll ignore rects with zero height or width in @@ -1496,12 +1512,12 @@ def _update_patch_limits(self, patch): def add_table(self, tab): - ''' + """ Add a :class:`~matplotlib.tables.Table` instance to the list of axes tables Returns the table. - ''' + """ self._set_artist_props(tab) self.tables.append(tab) tab.set_clip_path(self.patch) @@ -1509,12 +1525,12 @@ def add_table(self, tab): return tab def add_container(self, container): - ''' + """ Add a :class:`~matplotlib.container.Container` instance to the axes. Returns the collection. - ''' + """ label = container.get_label() if not label: container.set_label('_container%d'%len(self.containers)) @@ -1541,7 +1557,7 @@ def relim(self): self._update_patch_limits(p) def update_datalim(self, xys, updatex=True, updatey=True): - 'Update the data lim bbox with seq of xy tups or equiv. 2-D array' + """Update the data lim bbox with seq of xy tups or equiv. 2-D array""" # if no data is set currently, the bbox will ignore its # limits and set the bound to be the bounds of the xydata. # Otherwise, it will compute the bounds of it's current data @@ -1555,7 +1571,7 @@ def update_datalim(self, xys, updatex=True, updatey=True): self.ignore_existing_data_limits = False def update_datalim_numerix(self, x, y): - 'Update the data lim bbox with seq of xy tups' + """Update the data lim bbox with seq of xy tups""" # if no data is set currently, the bbox will ignore it's # limits and set the bound to be the bounds of the xydata. # Otherwise, it will compute the bounds of it's current data @@ -1565,14 +1581,14 @@ def update_datalim_numerix(self, x, y): self.ignore_existing_data_limits = False def update_datalim_bounds(self, bounds): - ''' + """ Update the datalim to include the given :class:`~matplotlib.transforms.Bbox` *bounds* - ''' + """ self.dataLim.set(mtransforms.Bbox.union([self.dataLim, bounds])) def _process_unit_info(self, xdata=None, ydata=None, kwargs=None): - 'look for unit *kwargs* and update the axis instances as necessary' + """Look for unit *kwargs* and update the axis instances as necessary""" if self.xaxis is None or self.yaxis is None: return @@ -1614,10 +1630,10 @@ def _process_unit_info(self, xdata=None, ydata=None, kwargs=None): self.yaxis.update_units(ydata) def in_axes(self, mouseevent): - ''' - return *True* if the given *mouseevent* (in display coords) + """ + Return *True* if the given *mouseevent* (in display coords) is in the Axes - ''' + """ return self.patch.contains(mouseevent)[0] def get_autoscale_on(self): @@ -1865,7 +1881,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True): @allow_rasterization def draw(self, renderer=None, inframe=False): - "Draw everything (plot lines, axes, labels)" + """Draw everything (plot lines, axes, labels)""" if renderer is None: renderer = self._cachedRenderer @@ -1908,12 +1924,9 @@ def draw(self, renderer=None, inframe=False): if self.axison and self._frameon: artists.extend(self.spines.itervalues()) - - dsu = [ (a.zorder, a) for a in artists if not a.get_animated() ] - # add images to dsu if the backend support compositing. # otherwise, does the manaul compositing without adding images to dsu. if len(self.images)<=1 or renderer.option_image_nocomposite(): @@ -1935,7 +1948,6 @@ def draw(self, renderer=None, inframe=False): else: dsu_rasterized = [] - # the patch draws the background rectangle -- the frame below # will draw the edges if self.axison and self._frameon: @@ -2301,7 +2313,7 @@ def set_axis_on(self): self.axison = True def get_axis_bgcolor(self): - 'Return the axis background color' + """Return the axis background color""" return self._axisbg def set_axis_bgcolor(self, color): @@ -2323,7 +2335,7 @@ def invert_xaxis(self): self.set_xlim(right, left) def xaxis_inverted(self): - 'Returns True if the x-axis is inverted.' + """Returns True if the x-axis is inverted.""" left, right = self.get_xlim() return right < left @@ -2457,9 +2469,9 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw): return left, right def get_xscale(self): - 'return the xaxis scale string: %s' % ( - ", ".join(mscale.get_scale_names())) return self.xaxis.get_scale() + get_xscale.__doc__ = "Return the xaxis scale string: %s""" % ( + ", ".join(mscale.get_scale_names())) @docstring.dedent_interpd def set_xscale(self, value, **kwargs): @@ -2480,7 +2492,7 @@ def set_xscale(self, value, **kwargs): self._update_transScale() def get_xticks(self, minor=False): - 'Return the x ticks as a list of locations' + """Return the x ticks as a list of locations""" return self.xaxis.get_ticklocs(minor=minor) def set_xticks(self, ticks, minor=False): @@ -2492,17 +2504,17 @@ def set_xticks(self, ticks, minor=False): return self.xaxis.set_ticks(ticks, minor=minor) def get_xmajorticklabels(self): - 'Get the xtick labels as a list of Text instances' + """Get the xtick labels as a list of Text instances""" return cbook.silent_list('Text xticklabel', self.xaxis.get_majorticklabels()) def get_xminorticklabels(self): - 'Get the xtick labels as a list of Text instances' + """Get the xtick labels as a list of Text instances""" return cbook.silent_list('Text xticklabel', self.xaxis.get_minorticklabels()) def get_xticklabels(self, minor=False): - 'Get the xtick labels as a list of Text instances' + """Get the xtick labels as a list of Text instances""" return cbook.silent_list('Text xticklabel', self.xaxis.get_ticklabels(minor=minor)) @@ -2531,7 +2543,7 @@ def invert_yaxis(self): self.set_ylim(top, bottom) def yaxis_inverted(self): - 'Returns True if the y-axis is inverted.' + """Returns True if the y-axis is inverted.""" bottom, top = self.get_ylim() return top < bottom @@ -2544,9 +2556,10 @@ def get_ybound(self): return top, bottom def set_ybound(self, lower=None, upper=None): - """Set the lower and upper numerical bounds of the y-axis. - This method will honor axes inversion regardless of parameter order. - It will not change the _autoscaleYon attribute. + """ + Set the lower and upper numerical bounds of the y-axis. + This method will honor axes inversion regardless of parameter order. + It will not change the _autoscaleYon attribute. """ if upper is None and iterable(lower): lower,upper = lower @@ -2660,9 +2673,9 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw): return bottom, top def get_yscale(self): - 'return the xaxis scale string: %s' % ( - ", ".join(mscale.get_scale_names())) return self.yaxis.get_scale() + get_yscale.__doc__ = "Return the yaxis scale string: %s""" % ( + ", ".join(mscale.get_scale_names())) @docstring.dedent_interpd def set_yscale(self, value, **kwargs): @@ -2683,7 +2696,7 @@ def set_yscale(self, value, **kwargs): self._update_transScale() def get_yticks(self, minor=False): - 'Return the y ticks as a list of locations' + """Return the y ticks as a list of locations""" return self.yaxis.get_ticklocs(minor=minor) def set_yticks(self, ticks, minor=False): @@ -2700,17 +2713,17 @@ def set_yticks(self, ticks, minor=False): return self.yaxis.set_ticks(ticks, minor=minor) def get_ymajorticklabels(self): - 'Get the xtick labels as a list of Text instances' + """Get the xtick labels as a list of Text instances""" return cbook.silent_list('Text yticklabel', self.yaxis.get_majorticklabels()) def get_yminorticklabels(self): - 'Get the xtick labels as a list of Text instances' + """Get the xtick labels as a list of Text instances""" return cbook.silent_list('Text yticklabel', self.yaxis.get_minorticklabels()) def get_yticklabels(self, minor=False): - 'Get the xtick labels as a list of Text instances' + """Get the xtick labels as a list of Text instances""" return cbook.silent_list('Text yticklabel', self.yaxis.get_ticklabels(minor=minor)) @@ -2734,7 +2747,8 @@ def set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs): minor=minor, **kwargs) def xaxis_date(self, tz=None): - """Sets up x-axis ticks and labels that treat the x data as dates. + """ + Sets up x-axis ticks and labels that treat the x data as dates. *tz* is a timezone string or :class:`tzinfo` instance. Defaults to rc value. @@ -2744,7 +2758,8 @@ def xaxis_date(self, tz=None): self.xaxis.axis_date(tz) def yaxis_date(self, tz=None): - """Sets up y-axis ticks and labels that treat the y data as dates. + """ + Sets up y-axis ticks and labels that treat the y data as dates. *tz* is a timezone string or :class:`tzinfo` instance. Defaults to rc value. @@ -2776,7 +2791,7 @@ def format_ydata(self, y): return val def format_coord(self, x, y): - 'return a format string formatting the *x*, *y* coord' + """Return a format string formatting the *x*, *y* coord""" if x is None: xs = '???' else: @@ -2843,7 +2858,9 @@ def start_pan(self, x, y, button): * 3: RIGHT .. note:: + Intended to be overridden by new projection types. + """ self._pan_start = cbook.Bunch( lim = self.viewLim.frozen(), @@ -2860,7 +2877,9 @@ def end_pan(self): is up.) .. note:: + Intended to be overridden by new projection types. + """ del self._pan_start @@ -2879,7 +2898,9 @@ def drag_pan(self, button, key, x, y): *x*, *y* are the mouse coordinates in display coords. .. note:: + Intended to be overridden by new projection types. + """ def format_deltas(key, dx, dy): if key=='control': @@ -2982,12 +3003,12 @@ def connect(self, s, func): 'instead') def disconnect(self, cid): - 'disconnect from the Axes event.' + """disconnect from the Axes event.""" raise DeprecationWarning('use the callbacks CallbackRegistry instance ' 'instead') def get_children(self): - 'return a list of child artists' + """return a list of child artists""" children = [] children.append(self.xaxis) children.append(self.yaxis) @@ -4121,7 +4142,7 @@ def acorr(self, x, **kwargs): *maxlags* is a positive integer detailing the number of lags to show. The default value of *None* will return all - :math:`2 \times \mathrm{len}(x) - 1` lags. + ``(2*len(x)-1)`` lags. The return value is a tuple (*lags*, *c*, *linecol*, *b*) where @@ -4917,7 +4938,7 @@ def stem(self, x, y, linefmt='b-', markerfmt='bo', basefmt='r-', *baseline*). .. seealso:: - This `document `_ + This `document `_ for details. @@ -8210,7 +8231,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None, return ret def matshow(self, Z, **kwargs): - ''' + """ Plot a matrix or array as an image. The matrix will be shown the way it would be printed, @@ -8227,7 +8248,7 @@ def matshow(self, Z, **kwargs): kwarg to "lower". Returns: an :class:`matplotlib.image.AxesImage` instance. - ''' + """ Z = np.asanyarray(Z) nr, nc = Z.shape kw = {'origin': 'upper', @@ -8296,7 +8317,7 @@ def minorticks_on(self): ax.set_minor_locator(mticker.AutoMinorLocator()) def minorticks_off(self): - 'Remove minor ticks from the axes.' + """Remove minor ticks from the axes.""" self.xaxis.set_minor_locator(mticker.NullLocator()) self.yaxis.set_minor_locator(mticker.NullLocator()) @@ -8376,27 +8397,27 @@ def __init__(self, fig, *args, **kwargs): def get_geometry(self): - 'get the subplot geometry, eg 2,2,3' + """get the subplot geometry, eg 2,2,3""" rows, cols, num1, num2 = self.get_subplotspec().get_geometry() return rows, cols, num1+1 # for compatibility # COVERAGE NOTE: Never used internally or from examples def change_geometry(self, numrows, numcols, num): - 'change subplot geometry, eg. from 1,1,1 to 2,2,3' + """change subplot geometry, eg. from 1,1,1 to 2,2,3""" self._subplotspec = GridSpec(numrows, numcols)[num-1] self.update_params() self.set_position(self.figbox) def get_subplotspec(self): - 'get the SubplotSpec instance associated with the subplot' + """get the SubplotSpec instance associated with the subplot""" return self._subplotspec def set_subplotspec(self, subplotspec): - 'set the SubplotSpec instance associated with the subplot' + """set the SubplotSpec instance associated with the subplot""" self._subplotspec = subplotspec def update_params(self): - 'update the subplot position from fig.subplotpars' + """update the subplot position from fig.subplotpars""" self.figbox, self.rowNum, self.colNum, self.numRows, self.numCols = \ self.get_subplotspec().get_position(self.figure, @@ -8435,7 +8456,7 @@ def label_outer(self): _subplot_classes = {} def subplot_class_factory(axes_class=None): - # This makes a new class that inherits from SubclassBase and the + # This makes a new class that inherits from SubplotBase and the # given axes_class (which is assumed to be a subclass of Axes). # This is perhaps a little bit roundabout to make a new class on # the fly like this, but it means that a new Subplot class does diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index e08813694bed..78de72cb2833 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -176,7 +176,7 @@ def get_pad_pixels(self): def contains(self, mouseevent): """ - Test whether the mouse event occured in the Tick marks. + Test whether the mouse event occurred in the Tick marks. This function always returns false. It is more useful to test if the axis as a whole contains the mouse rather than the set of tick marks. @@ -1147,7 +1147,7 @@ def get_ticklocs(self, minor=False): return self.major.locator() def _get_tick(self, major): - 'return the default tick intsance' + 'return the default tick instance' raise NotImplementedError('derived must override') def _copy_tick_props(self, src, dest): diff --git a/lib/matplotlib/backends/backend_svg.py b/lib/matplotlib/backends/backend_svg.py index 25891630841a..02f3a3da73b0 100644 --- a/lib/matplotlib/backends/backend_svg.py +++ b/lib/matplotlib/backends/backend_svg.py @@ -718,7 +718,7 @@ def draw_image(self, gc, x, y, im, dx=None, dy=None, transform=None): clipid = self._get_clip(gc) if clipid is not None: # Can't apply clip-path directly to the image because the - # image as a transformation, which would also be applied + # image has a transformation, which would also be applied # to the clip-path self.writer.start('g', attrib={'clip-path': 'url(#%s)' % clipid}) diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 9b7076795e72..52f894bdf93c 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -27,6 +27,7 @@ from matplotlib.transforms import BboxBase, Bbox import matplotlib.transforms as mtransforms + class _AxesImageBase(martist.Artist, cm.ScalarMappable): zorder = 0 # map interpolation strings to module constants @@ -69,7 +70,6 @@ def __init__(self, ax, resample = False, **kwargs ): - """ interpolation and cmap default to their rc settings @@ -100,14 +100,14 @@ def __init__(self, ax, # this is an experimental attribute, if True, unsampled image # will be drawn using the affine transform that are - # appropriately skewed so that the given postition + # appropriately skewed so that the given position # corresponds to the actual position in the coordinate. -JJL self._image_skew_coordinate = None self.update(kwargs) def get_size(self): - 'Get the numrows, numcols of the input image' + """Get the numrows, numcols of the input image""" if self._A is None: raise RuntimeError('You must first set the image array') @@ -135,7 +135,6 @@ def changed(self): def make_image(self, magnification=1.0): raise RuntimeError('The make_image method must be overridden.') - def _get_unsampled_image(self, A, image_extents, viewlim): """ convert numpy array A with given extents ([x1, x2, y1, y2] in @@ -217,7 +216,6 @@ def _get_unsampled_image(self, A, image_extents, viewlim): return im, xmin, ymin, dxintv, dyintv, sx, sy - @staticmethod def _get_rotate_and_skew_transform(x1, y1, x2, y2, x3, y3): """ @@ -247,19 +245,16 @@ def _get_rotate_and_skew_transform(x1, y1, x2, y2, x3, y3): return tr - def _draw_unsampled_image(self, renderer, gc): """ draw unsampled image. The renderer should support a draw_image method with scale parameter. """ - - trans = self.get_transform() #axes.transData # convert the coordinates to the intermediate coordinate (ic). # The transformation from the ic to the canvas is a pure - # affine transfor. + # affine transform. # A straight-forward way is to use the non-affine part of the # original transform for conversion to the ic. @@ -290,7 +285,7 @@ def _draw_unsampled_image(self, renderer, gc): else: trans_ic_to_canvas = trans.get_affine() - # Now, viewLim in the ic. It can be roated and can be + # Now, viewLim in the ic. It can be rotated and can be # skewed. Make it big enough. x1, y1, x2, y2 = self.axes.bbox.extents trans_canvas_to_ic = trans_ic_to_canvas.inverted() @@ -326,7 +321,6 @@ def _draw_unsampled_image(self, renderer, gc): renderer.draw_image(gc, xmin, ymin, im, dxintv, dyintv, trans_ic_to_canvas) - def _check_unsampled_image(self, renderer): """ return True if the image is better to be drawn unsampled. @@ -423,7 +417,7 @@ def set_data(self, A): def set_array(self, A): """ - retained for backwards compatibility - use set_data instead + Retained for backwards compatibility - use set_data instead ACCEPTS: numpy array A or PIL Image""" # This also needs to be here to override the inherited @@ -432,8 +426,6 @@ def set_array(self, A): self.set_data(A) - - def get_interpolation(self): """ Return the interpolation method the image uses when resizing. @@ -441,6 +433,7 @@ def get_interpolation(self): One of 'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos', or 'none'. + """ return self._interpolation @@ -467,7 +460,7 @@ def set_interpolation(self, s): def set_resample(self, v): """ - set whether or not image resampling is used + Set whether or not image resampling is used ACCEPTS: True|False """ @@ -475,7 +468,7 @@ def set_resample(self, v): self._resample = v def get_resample(self): - 'return the image resample boolean' + """Return the image resample boolean""" return self._resample def set_filternorm(self, filternorm): @@ -491,7 +484,7 @@ def set_filternorm(self, filternorm): self._filternorm = 0 def get_filternorm(self): - 'return the filternorm setting' + """Return the filternorm setting""" return self._filternorm def set_filterrad(self, filterrad): @@ -506,7 +499,7 @@ def set_filterrad(self, filterrad): self._filterrad = r def get_filterrad(self): - 'return the filterrad setting' + """return the filterrad setting""" return self._filterrad @@ -646,7 +639,7 @@ def set_extent(self, extent): self.axes.set_ylim((ymin, ymax), auto=None) def get_extent(self): - 'get the image extent: left, right, bottom, top' + """Get the image extent: left, right, bottom, top""" if self._extent is not None: return self._extent else: @@ -780,12 +773,12 @@ def set_cmap(self, cmap): cm.ScalarMappable.set_cmap(self, cmap) class PcolorImage(martist.Artist, cm.ScalarMappable): - ''' + """ Make a pcolor-style plot with an irregular rectangular grid. This uses a variation of the original irregular image code, and it is used by pcolorfast for the corresponding grid type. - ''' + """ def __init__(self, ax, x=None, y=None, @@ -933,8 +926,7 @@ def __init__(self, fig, self.magnification = 1.0 def contains(self, mouseevent): - """Test whether the mouse event occured within the image. - """ + """Test whether the mouse event occured within the image.""" if callable(self._contains): return self._contains(self,mouseevent) xmin, xmax, ymin, ymax = self.get_extent() xdata, ydata = mouseevent.x, mouseevent.y @@ -947,29 +939,24 @@ def contains(self, mouseevent): return inside,{} def get_size(self): - 'Get the numrows, numcols of the input image' + """Get the numrows, numcols of the input image""" if self._A is None: raise RuntimeError('You must first set the image array') return self._A.shape[:2] def get_extent(self): - 'get the image extent: left, right, bottom, top' + """Get the image extent: left, right, bottom, top""" numrows, numcols = self.get_size() return (-0.5+self.ox, numcols-0.5+self.ox, -0.5+self.oy, numrows-0.5+self.oy) def set_data(self, A): - """ - Set the image array - - """ + """Set the image array.""" cm.ScalarMappable.set_array(self, cbook.safe_masked_invalid(A)) def set_array(self, A): - """ - Deprecated; use set_data for consistency with other image types. - """ + """Deprecated; use set_data for consistency with other image types.""" self.set_data(A) def make_image(self, magnification=1.0): @@ -1022,9 +1009,7 @@ def write_png(self, fname): class BboxImage(_AxesImageBase): - """ - The Image class whose size is determined by the given bbox. - """ + """The Image class whose size is determined by the given bbox.""" def __init__(self, bbox, cmap = None, norm = None, @@ -1041,8 +1026,8 @@ def __init__(self, bbox, norm is a colors.Normalize instance to map luminance to 0-1 kwargs are an optional list of Artist keyword args - """ + """ _AxesImageBase.__init__(self, ax=None, cmap = cmap, norm = norm, @@ -1069,9 +1054,7 @@ def get_window_extent(self, renderer=None): def contains(self, mouseevent): - """Test whether the mouse event occured within the image. - """ - + """Test whether the mouse event occured within the image.""" if callable(self._contains): return self._contains(self,mouseevent) if not self.get_visible():# or self.get_figure()._renderer is None: @@ -1083,7 +1066,7 @@ def contains(self, mouseevent): return inside,{} def get_size(self): - 'Get the numrows, numcols of the input image' + """Get the numrows, numcols of the input image""" if self._A is None: raise RuntimeError('You must first set the image array') @@ -1141,7 +1124,6 @@ def make_image(self, renderer, magnification=1.0): norm=self._filternorm, radius=self._filterrad) return im - @allow_rasterization def draw(self, renderer, *args, **kwargs): if not self.get_visible(): return @@ -1157,7 +1139,6 @@ def draw(self, renderer, *args, **kwargs): gc.restore() - def imread(fname, format=None): """ Return image file in *fname* as :class:`numpy.array`. *fname* may @@ -1178,7 +1159,7 @@ def imread(fname, format=None): """ def pilread(): - 'try to load the image with PIL or return None' + """try to load the image with PIL or return None""" try: from PIL import Image except ImportError: return None image = Image.open( fname ) @@ -1260,7 +1241,7 @@ def pil_to_array( pilImage ): return value is MxNx3. For RGBA images the return value is MxNx4 """ def toarray(im): - 'return a 1D array of floats' + """Teturn a 1D array of floats.""" x_str = im.tostring('raw',im.mode,0,-1) x = np.fromstring(x_str,np.uint8) return x @@ -1291,6 +1272,7 @@ def toarray(im): x.shape = im.size[1], im.size[0], 4 return x + def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear', preview=False): """ @@ -1328,7 +1310,6 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear', Return value is the figure instance containing the thumbnail """ - basedir, basename = os.path.split(infile) baseout, extout = os.path.splitext(thumbfile) @@ -1339,7 +1320,6 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear', # need it for the mpl API dpi = 100 - height = float(rows)/dpi*scale width = float(cols)/dpi*scale diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index ccccd544b7e3..ce9efceb4ac3 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -43,7 +43,7 @@ class Patch(artist.Artist): """ - A patch is a 2D thingy with a face color and an edge color. + A patch is a 2D artist with a face color and an edge color. If any of *edgecolor*, *facecolor*, *linewidth*, or *antialiased* are *None*, they default to their rc params setting. diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index cd91222857f4..14a824742611 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -59,10 +59,13 @@ class Path(object): at all, but have a default one provided for them by :meth:`iter_segments`. - Note also that the vertices and codes arrays should be treated as - immutable -- there are a number of optimizations and assumptions - made up front in the constructor that will not change when the - data changes. + .. note:: + + The vertices and codes arrays should be treated as + immutable -- there are a number of optimizations and assumptions + made up front in the constructor that will not change when the + data changes. + """ # Path codes diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index ec5526cddcb1..b982a0f8f490 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -756,4 +756,3 @@ def drag_pan(self, button, key, x, y): # return mpath.Path(result, codes) # transform_path_non_affine = transform_path - diff --git a/lib/matplotlib/sankey.py b/lib/matplotlib/sankey.py index c338c1f10882..508680659630 100644 --- a/lib/matplotlib/sankey.py +++ b/lib/matplotlib/sankey.py @@ -54,6 +54,7 @@ class Sankey: "Sankey diagrams are a specific type of flow diagram, in which the width of the arrows is shown proportionally to the flow quantity. They are typically used to visualize energy or material or cost transfers between processes." + --http://en.wikipedia.org/wiki/Sankey_diagram, accessed 6/1/2011 """ def _arc(self, quadrant=0, cw=True, radius=1, center=(0,0)): @@ -246,9 +247,9 @@ def add(self, patchlabel='', flows=np.array([1.0,-1.0]), orientations=[0,0], Optional keyword arguments: - =============== ========================================== + =============== ========================================================== Keyword Description - =============== ========================================== + =============== ========================================================== *patchlabel* label to be placed at the center of the diagram Note: *label* (not *patchlabel*) will be passed to the patch through **kwargs and can be used to create @@ -293,9 +294,9 @@ def add(self, patchlabel='', flows=np.array([1.0,-1.0]), orientations=[0,0], will be rotated accordingly (e.g., if *rotation* == 90, an *orientations* entry of 1 means to/from the left). - =============== ========================================== + =============== ========================================================== - Valid kwargs are :meth:`~matplotlib.patches.PathPatch` arguments: + Valid kwargs are :meth:`matplotlib.patches.PathPatch` arguments: %(PathPatch)s As examples, *fill*=False and *label*="A legend entry". By default, *facecolor*='#bfd1d4' (light blue) and *lineweight*=0.5. @@ -664,9 +665,9 @@ def finish(self): Return value is a list of subdiagrams represented with the following fields: - =============== ========================================== + =============== ===================================================== Field Description - =============== ========================================== + =============== ===================================================== *patch* Sankey outline (an instance of :class:`~maplotlib.patches.PathPatch`) *flows* values of the flows (positive for input, negative @@ -689,7 +690,7 @@ def finish(self): label of the diagram *texts* list of :class:`~matplotlib.text.Text` instances for the labels of flows - =============== ========================================== + =============== ===================================================== .. seealso:: @@ -718,9 +719,9 @@ def __init__(self, ax=None, scale=1.0, unit='', format='%G', gap=0.25, Optional keyword arguments: - =============== ========================================== + =============== ==================================================== Field Description - =============== ========================================== + =============== ==================================================== *ax* axes onto which the data should be plotted If *ax* isn't provided, new axes will be created. *scale* scaling factor for the flows @@ -751,7 +752,7 @@ def __init__(self, ax=None, scale=1.0, unit='', format='%G', gap=0.25, flows The magnitude of the sum of connected flows cannot be greater than *tolerance*. - =============== ========================================== + =============== ==================================================== The optional arguments listed above are applied to all subdiagrams so that there is consistent alignment and formatting. diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index a4bd59218138..09adeecec627 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -1047,6 +1047,7 @@ class TextWithDash(Text): amount in canvas units. (default = 0) .. note:: + The alignment of the two objects is based on the bounding box of the :class:`~matplotlib.text.Text`, as obtained by :meth:`~matplotlib.artist.Artist.get_window_extent`. This, in @@ -1056,10 +1057,12 @@ class TextWithDash(Text): backend used. .. note:: + I'm not sure that I got the :meth:`~matplotlib.text.TextWithDash.get_window_extent` right, or whether that's sufficient for providing the object bounding box. + """ __name__ = 'textwithdash' diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index c180e5dbe38d..9920dc9ebccf 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -208,7 +208,7 @@ def fix_minus(self, s): Note, if you use this method, eg in :meth`format_data` or call, you probably don't want to use it for :meth:`format_data_short` since the toolbar uses this for - interative coord reporting and I doubt we can expect GUIs + interactive coord reporting and I doubt we can expect GUIs across platforms will handle the unicode correctly. So for now the classes that override :meth:`fix_minus` should have an explicit :meth:`format_data_short` method diff --git a/lib/matplotlib/tight_bbox.py b/lib/matplotlib/tight_bbox.py index 53d0606a4092..aee105a93f2d 100644 --- a/lib/matplotlib/tight_bbox.py +++ b/lib/matplotlib/tight_bbox.py @@ -15,7 +15,7 @@ def adjust_bbox(fig, format, bbox_inches): It modifies fig.bbox, fig.bbox_inches, fig.transFigure._boxout, and fig.patch. While the figure size changes, the scale of the original figure is conserved. A - function whitch restores the original values are returned. + function which restores the original values are returned. """ origBbox = fig.bbox diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index d76214f3eafc..dcc079f965b2 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -212,7 +212,7 @@ class BboxBase(TransformNode): The canonical representation is as two points, with no restrictions on their ordering. Convenience properties are provided to get the left, bottom, right and top edges and width - and height, but these are not stored explicity. + and height, but these are not stored explicitly. """ is_bbox = True is_affine = True @@ -1021,7 +1021,7 @@ class Transform(TransformNode): - :meth:`inverted` (if :meth:`has_inverse` can return True) If the transform needs to do something non-standard with - :class:`mathplotlib.path.Path` objects, such as adding curves + :class:`matplotlib.path.Path` objects, such as adding curves where there were once line segments, it should override: - :meth:`transform_path` @@ -1376,11 +1376,6 @@ class Affine2DBase(AffineBase): input_dims = 2 output_dims = 2 - #* Redundant: Removed for performance - # - # def __init__(self): - # Affine2DBase.__init__(self) - def frozen(self): return Affine2D(self.get_matrix().copy()) frozen.__doc__ = AffineBase.frozen.__doc__ @@ -1494,6 +1489,7 @@ def from_values(a, b, c, d, e, f): a c e b d f 0 0 1 + """ return Affine2D( np.array([a, c, e, b, d, f, 0.0, 0.0, 1.0], np.float_) @@ -1518,6 +1514,7 @@ def set_matrix(self, mtx): a c e b d f 0 0 1 + """ self._mtx = mtx self.invalidate() @@ -2206,6 +2203,12 @@ class TransformedPath(TransformNode): the :class:`~matplotlib.path.Path`. This cached copy is automatically updated when the non-affine part of the transform changes. + + .. note:: + + Paths are considered immutable by this class. Any update to the + path's vertices/codes will not trigger a transform recomputation. + """ def __init__(self, path, transform): """ diff --git a/lib/mpl_toolkits/axisartist/axislines.py b/lib/mpl_toolkits/axisartist/axislines.py index 965df130127c..b106f7dfa2f7 100644 --- a/lib/mpl_toolkits/axisartist/axislines.py +++ b/lib/mpl_toolkits/axisartist/axislines.py @@ -109,7 +109,7 @@ def get_tick_transform(self, axes): return trans def get_tick_iterators(self, axes): - # iter : iteratable object that yields (c, angle, l) where + # iter : iterable object that yields (c, angle, l) where # c, angle, l is position, tick angle, and label return iter_major, iter_minor