Thanks to visit codestin.com
Credit goes to github.com

Skip to content

slow_update #548

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

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ progress::

matplotlib requires numpy version 1.1 or later. Although it is not a
requirement to use matplotlib, we strongly encourage you to install
`ipython <http://ipython.scipy.org/dist>`_, which is an interactive
`ipython <http://ipython.org>`_, which is an interactive
shell for python that is matplotlib-aware.

Next, we need to get matplotlib installed. We provide prebuilt
Expand Down
2 changes: 1 addition & 1 deletion doc/_templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>intro</h1>
publication quality figures in a variety of hardcopy formats and
interactive environments across platforms. matplotlib can be used
in python scripts, the python and <a
href="http://ipython.scipy.org">ipython</a> shell (ala
href="http://ipython.org">ipython</a> shell (ala
MATLAB<sup>&reg;<a name="matlab" href="#ftn.matlab">*</a></sup>
or
Mathematica<sup>&reg;<a name="mathematica"
Expand Down
4 changes: 2 additions & 2 deletions doc/_templates/indexsidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ <h3>Videos</h3>
<h3>Toolkits</h3>

<p>There are several matplotlib add-on <a href="{{
pathto('users/toolkits') }}">toolkits</a>, including the projection
pathto('mpl_toolkits/index') }}">toolkits</a>, including the projection
and mapping toolkit
<a href="http://matplotlib.sf.net/basemap/doc/html">basemap</a>, 3d plotting with <a href="{{
<a href="http://matplotlib.github.com/basemap">basemap</a>, 3d plotting with <a href="{{
pathto('mpl_toolkits/mplot3d/index') }}">mplot3d</a>, axes and axis helpers in <a href="{{
pathto('mpl_toolkits/axes_grid/index') }}">axes_grid</a> and more.
</p>
Expand Down
2 changes: 1 addition & 1 deletion doc/devel/gitwash/known_projects.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
.. _`nipy mailing list`: http://mail.scipy.org/mailman/listinfo/nipy-devel

.. ipython
.. _ipython: http://ipython.scipy.org
.. _ipython: http://ipython.org
.. _`ipython github`: http://github.com/ipython/ipython
.. _`ipython mailing list`: http://mail.scipy.org/mailman/listinfo/IPython-dev

Expand Down
2 changes: 1 addition & 1 deletion doc/mpl_toolkits/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Basemap
=======

Plots data on map projections, with continental and political
boundaries, see `basemap <http://matplotlib.sf.net/basemap/doc/html>`_
boundaries, see `basemap <http://matplotlib.github.com/basemap>`_
docs.

.. _toolkit_gtk:
Expand Down
24 changes: 12 additions & 12 deletions doc/sphinxext/gen_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ def generate_example_rst(app):

fhsubdirIndex.write(' %s <%s>\n'%(os.path.basename(basename),rstfile))

do_plot = (subdir in ('api',
'pylab_examples',
'units',
'mplot3d',
'axes_grid',
) and
not noplot_regex.search(contents))
if not do_plot:
fhstatic = file(outputfile, 'w')
fhstatic.write(contents)
fhstatic.close()

if not out_of_date(fullpath, outrstfile):
continue

Expand All @@ -121,25 +133,13 @@ def generate_example_rst(app):
title = '%s example code: %s'%(subdir, fname)
#title = '<img src=%s> %s example code: %s'%(thumbfile, subdir, fname)


fh.write(title + '\n')
fh.write('='*len(title) + '\n\n')

do_plot = (subdir in ('api',
'pylab_examples',
'units',
'mplot3d',
'axes_grid',
) and
not noplot_regex.search(contents))

if do_plot:
fh.write("\n\n.. plot:: %s\n\n::\n\n" % fullpath)
else:
fh.write("[`source code <%s>`_]\n\n::\n\n" % fname)
fhstatic = file(outputfile, 'w')
fhstatic.write(contents)
fhstatic.close()

# indent the contents
contents = '\n'.join([' %s'%row.rstrip() for row in contents.split('\n')])
Expand Down
2 changes: 1 addition & 1 deletion doc/users/artists.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ In this example, ``ax`` is the ``Axes`` instance created by the
subclass of ``Axes``) and when you call ``ax.plot``, it creates a
``Line2D`` instance and adds it to the :attr:`Axes.lines
<matplotlib.axes.Axes.lines>` list. In the interactive `ipython
<http://ipython.scipy.org/>`_ session below, you can see that the
<http://ipython.org/>`_ session below, you can see that the
``Axes.lines`` list is length one and contains the same line that was
returned by the ``line, = ax.plot...`` call:

Expand Down
4 changes: 2 additions & 2 deletions doc/users/credits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Fernando Perez
has provided numerous bug reports and patches for cleaning up
backend imports and expanding pylab functionality, and provided
matplotlib support in the pylab mode for `ipython
<http://ipython.scipy.org>`_. He also provided the
<http://ipython.org>`_. He also provided the
:func:`~matplotlib.pyplot.matshow` command, and wrote TConfig, which
is the basis for the experimental traited mpl configuration.

Expand Down Expand Up @@ -149,7 +149,7 @@ Nicolas Young
sampled images.

The `brainvisa <http://brainvisa.info>`_ Orsay team and Fernando Perez
added Qt support to `ipython <http://ipython.scipy.org>`_ in pylab mode.
added Qt support to `ipython <http://ipython.org>`_ in pylab mode.


Charlie Moad
Expand Down
2 changes: 1 addition & 1 deletion doc/users/shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ python shell.
Ipython to the rescue
=====================

Fortunately, `ipython <http://ipython.scipy.org/dist>`_, an enhanced
Fortunately, `ipython <http://ipython.org/>`_, an enhanced
interactive python shell, has figured out all of these tricks, and is
matplotlib aware, so when you start ipython in the *pylab* mode.

Expand Down
40 changes: 35 additions & 5 deletions lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,8 @@ def __init__(self, axes, pickradius=15):
self._major_tick_kw = dict()
self._minor_tick_kw = dict()

self._reset_tick_cache()

self.cla()
self.set_scale('linear')

Expand Down Expand Up @@ -741,6 +743,12 @@ def reset_ticks(self):
self._lastNumMajorTicks = 1
self._lastNumMinorTicks = 1

self._reset_tick_cache()

def _reset_tick_cache(self):
self._last_interval = None
self._last_ticks_to_draw = None

def set_tick_params(self, which='major', reset=False, **kw):
"""
Set appearance parameters for ticks and ticklabels.
Expand All @@ -767,6 +775,7 @@ def set_tick_params(self, which='major', reset=False, **kw):
if which == 'minor' or which == 'both':
for tick in self.minorTicks:
tick._apply_params(**self._minor_tick_kw)
self._reset_tick_cache()

@staticmethod
def _translate_tick_kw(kw, to_init_kw=True):
Expand Down Expand Up @@ -910,6 +919,7 @@ def get_ticklabel_extents(self, renderer):
def set_smart_bounds(self,value):
"""set the axis to have smart bounds"""
self._smart_bounds = value
self._reset_tick_cache()

def get_smart_bounds(self):
"""get whether the axis has smart bounds"""
Expand All @@ -921,12 +931,18 @@ def _update_ticks(self, renderer):
interval of the axes. Returns a list of ticks that will be
drawn.
"""
view_interval = self.get_view_interval()
axis_interval = self.get_axis_interval()
if (self._last_interval is not None and
np.all(self._last_interval[0] == view_interval) and
np.all(self._last_interval[1] == axis_interval)):
return self._last_ticks_to_draw
self._last_interval = (view_interval.copy(), axis_interval.copy())

interval = self.get_view_interval()
tick_tups = [ t for t in self.iter_ticks()]
tick_tups = list(self.iter_ticks())
if self._smart_bounds:
# handle inverted limits
view_low, view_high = min(*interval), max(*interval)
view_low, view_high = min(*view_interval), max(*view_interval)
data_low, data_high = self.get_data_interval()
if data_low > data_high:
data_low, data_high = data_high, data_low
Expand Down Expand Up @@ -966,12 +982,14 @@ def _update_ticks(self, renderer):
ticks_to_draw = []
for tick, loc, label in tick_tups:
if tick is None: continue
if not mtransforms.interval_contains(interval, loc): continue
if not mtransforms.interval_contains(view_interval, loc): continue
tick.update_position(loc)
tick.set_label1(label)
tick.set_label2(label)
ticks_to_draw.append(tick)

self._last_ticks_to_draw = ticks_to_draw

return ticks_to_draw

def _get_tick_bboxes(self, ticks, renderer):
Expand Down Expand Up @@ -1434,6 +1452,8 @@ def set_ticklabels(self, ticklabels, *args, **kwargs):

ACCEPTS: sequence of strings
"""
self._reset_tick_cache()

#ticklabels = [str(l) for l in ticklabels]
minor = kwargs.pop('minor', False)
if minor:
Expand Down Expand Up @@ -1463,6 +1483,8 @@ def set_ticks(self, ticks, minor=False):

ACCEPTS: sequence of floats
"""
self._reset_tick_cache()

### XXX if the user changes units, the information will be lost here
ticks = self.convert_units(ticks)
if len(ticks) > 1:
Expand Down Expand Up @@ -1730,6 +1752,8 @@ def set_view_interval(self, vmin, vmax, ignore=False):
:meth:`~matplotlib.axes.Axes.set_xlim`.

"""
self._reset_tick_cache()

if ignore:
self.axes.viewLim.intervalx = vmin, vmax
else:
Expand Down Expand Up @@ -1774,7 +1798,8 @@ def set_default_intervals(self):
if not viewMutated:
self.axes.viewLim.intervalx = xmin, xmax


def get_axis_interval(self):
return self.axes.bbox.intervalx

class YAxis(Axis):
__name__ = 'yaxis'
Expand Down Expand Up @@ -1996,6 +2021,8 @@ def set_view_interval(self, vmin, vmax, ignore=False):
:meth:`~matplotlib.axes.Axes.set_ylim`.

"""
self._reset_tick_cache()

if ignore:
self.axes.viewLim.intervaly = vmin, vmax
else:
Expand Down Expand Up @@ -2038,3 +2065,6 @@ def set_default_intervals(self):
self.axes.dataLim.intervaly = ymin, ymax
if not viewMutated:
self.axes.viewLim.intervaly = ymin, ymax

def get_axis_interval(self):
return self.axes.bbox.intervaly
10 changes: 6 additions & 4 deletions lib/matplotlib/backends/backend_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _get_hatch(self, gc, rgbFace):
else:
_, oid = oid
return oid

def _write_hatches(self):
if not len(self._hatchd):
return
Expand Down Expand Up @@ -445,7 +445,7 @@ def _write_clips(self):
writer.element('rect', x=str(x), y=str(y), width=str(w), height=str(h))
writer.end('clipPath')
writer.end('defs')

def _write_svgfonts(self):
if not rcParams['svg.fonttype'] == 'svgfont':
return
Expand Down Expand Up @@ -926,7 +926,8 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath):
fontstyle = prop.get_style()

attrib = {}
style['font-size'] = str(fontsize)
# Must add "px" to workaround a Firefox bug
style['font-size'] = str(fontsize) + 'px'
style['font-family'] = str(fontfamily)
style['font-style'] = prop.get_style().lower()
attrib['style'] = generate_css(style)
Expand Down Expand Up @@ -967,7 +968,8 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath):
spans = {}
for font, fontsize, thetext, new_x, new_y, metrics in svg_glyphs:
style = generate_css({
'font-size': str(fontsize),
# Must add "px" to work around a Firefox bug
'font-size': str(fontsize) + 'px',
'font-family': font.family_name,
'font-style': font.style_name.lower()})
if thetext == 32:
Expand Down
19 changes: 10 additions & 9 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,13 +827,13 @@ def draw(self, renderer):
dsu = []

for a in self.patches:
dsu.append( (a.get_zorder(), a.draw, [renderer]))
dsu.append( (a.get_zorder(), a, a.draw, [renderer]))

for a in self.lines:
dsu.append( (a.get_zorder(), a.draw, [renderer]))
dsu.append( (a.get_zorder(), a, a.draw, [renderer]))

for a in self.artists:
dsu.append( (a.get_zorder(), a.draw, [renderer]))
dsu.append( (a.get_zorder(), a, a.draw, [renderer]))

# override the renderer default if self.suppressComposite
# is not None
Expand All @@ -844,7 +844,7 @@ def draw(self, renderer):
if len(self.images)<=1 or not_composite or \
not allequal([im.origin for im in self.images]):
for a in self.images:
dsu.append( (a.get_zorder(), a.draw, [renderer]))
dsu.append( (a.get_zorder(), a, a.draw, [renderer]))
else:
# make a composite image blending alpha
# list of (_image.Image, ox, oy)
Expand All @@ -866,21 +866,22 @@ def draw_composite():
renderer.draw_image(gc, l, b, im)
gc.restore()

dsu.append((self.images[0].get_zorder(), draw_composite, []))
dsu.append((self.images[0].get_zorder(), self.images[0], draw_composite, []))

# render the axes
for a in self.axes:
dsu.append( (a.get_zorder(), a.draw, [renderer]))
dsu.append( (a.get_zorder(), a, a.draw, [renderer]))

# render the figure text
for a in self.texts:
dsu.append( (a.get_zorder(), a.draw, [renderer]))
dsu.append( (a.get_zorder(), a, a.draw, [renderer]))

for a in self.legends:
dsu.append( (a.get_zorder(), a.draw, [renderer]))
dsu.append( (a.get_zorder(), a, a.draw, [renderer]))

dsu = [row for row in dsu if not row[1].get_animated()]
dsu.sort(key=itemgetter(0))
for zorder, func, args in dsu:
for zorder, a, func, args in dsu:
func(*args)

renderer.close_group('figure')
Expand Down
11 changes: 7 additions & 4 deletions lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,10 +764,13 @@ def run(arguments, content, options, state_machine, state, lineno):
shutil.copyfile(fn, destimg)

# copy script (if necessary)
target_name = os.path.join(dest_dir, output_base + source_ext)
f = open(target_name, 'w')
if source_file_name == rst_file:
target_name = os.path.join(dest_dir, output_base + source_ext)
f = open(target_name, 'w')
f.write(unescape_doctest(code))
f.close()
code_escaped = unescape_doctest(code)
else:
code_escaped = code
f.write(code_escaped)
f.close()

return errors
2 changes: 1 addition & 1 deletion lib/matplotlib/tri/triangulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_from_args_and_kwargs(*args, **kwargs):
@property
def neighbors(self):
if self._neighbors is None:
self._neighbors = self._get_cpp_triangulation().get_neighbors()
self._neighbors = self.get_cpp_triangulation().get_neighbors()
return self._neighbors

def set_mask(self, mask):
Expand Down
Loading