Skip to content

Commit 05541c4

Browse files
committed
Merge remote-tracking branch 'upstream/v1.2.x' into test_merge
Conflicts: lib/matplotlib/pyplot.py
2 parents dfd0345 + 106541d commit 05541c4

File tree

6 files changed

+44
-30
lines changed

6 files changed

+44
-30
lines changed

boilerplate.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ def %(func)s(%(argspec)s):
4747
%(ax)s = gca()
4848
# allow callers to override the hold state by passing hold=True|False
4949
%(washold)s = %(ax)s.ishold()
50-
%(sethold)s
50+
%(sethold)s
5151
if hold is not None:
5252
%(ax)s.hold(hold)
5353
try:
5454
%(ret)s = %(ax)s.%(func)s(%(call)s)
5555
draw_if_interactive()
5656
finally:
5757
%(ax)s.hold(%(washold)s)
58-
%(mappable)s
58+
%(mappable)s
5959
return %(ret)s
6060
"""
6161

@@ -199,7 +199,7 @@ def format_value(value):
199199
# For some commands, an additional line is needed to set the
200200
# color map
201201
if func in cmappable:
202-
mappable = cmappable[func] % locals()
202+
mappable = ' ' + cmappable[func] % locals()
203203
else:
204204
mappable = ''
205205

@@ -232,7 +232,7 @@ def format_value(value):
232232
# argument in front of it since it would gobble one of the
233233
# arguments the user means to pass via *args)
234234
if varargs:
235-
sethold = "hold = %(varkw)s.pop('hold', None)" % locals()
235+
sethold = " hold = %(varkw)s.pop('hold', None)" % locals()
236236
elif fmt is PLOT_TEMPLATE:
237237
args.append('hold')
238238
defaults = defaults + (None,)
@@ -306,6 +306,7 @@ def build_pyplot():
306306
pyplot.write('\n')
307307

308308
pyplot.writelines(boilerplate_gen())
309+
pyplot.write('\n')
309310

310311

311312
if __name__ == '__main__':

examples/pylab_examples/histogram_demo_extended.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
w1 = np.ones_like(x1)
112112
w1[:len(x1)/2] = 0.5
113113
w2 = np.ones_like(x2)
114-
w0[:len(x2)/2] = 0.5
114+
w2[:len(x2)/2] = 0.5
115115

116116

117117

lib/matplotlib/axes.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -5316,11 +5316,12 @@ def errorbar(self, x, y, yerr=None, xerr=None,
53165316
Optional keyword arguments:
53175317
53185318
*xerr*/*yerr*: [ scalar | N, Nx1, or 2xN array-like ]
5319-
If a scalar number, len(N) array-like object, or an Nx1 array-like
5320-
object, errorbars are drawn +/- value.
5319+
If a scalar number, len(N) array-like object, or an Nx1
5320+
array-like object, errorbars are drawn at +/-value relative
5321+
to the data.
53215322
5322-
If a sequence of shape 2xN, errorbars are drawn at -row1 and
5323-
+row2
5323+
If a sequence of shape 2xN, errorbars are drawn at -row1
5324+
and +row2 relative to the data.
53245325
53255326
*fmt*: '-'
53265327
The plot format symbol. If *fmt* is *None*, only the

lib/matplotlib/pylab.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
specgram - a spectrogram plot
8484
spy - plot sparsity pattern using markers or image
8585
stem - make a stem plot
86-
subplot - make a subplot (numrows, numcols, axesnum)
86+
subplot - make a subplot (nrows, ncols, plot_number)
8787
subplots_adjust - change the params controlling the subplot positions of current figure
8888
subplot_tool - launch the subplot configuration tool
8989
suptitle - add a figure title

lib/matplotlib/pyplot.py

+31-19
Original file line numberDiff line numberDiff line change
@@ -716,35 +716,47 @@ def gca(**kwargs):
716716

717717
def subplot(*args, **kwargs):
718718
"""
719-
Create a new axes (subplot).
719+
Return a subplot axes positioned by the given grid definition.
720720
721-
Creating axes with::
721+
Typical call signature::
722722
723-
subplot(numRows, numCols, plotNum)
723+
subplot(nrows, ncols, plot_number)
724724
725-
where *plotNum* = 1 is the first plot number and increasing *plotNums*
726-
fill rows first. max(*plotNum*) == *numRows* * *numCols*
725+
Where *nrows* and *ncols* are used to notionally split the figure
726+
into ``nrows * ncols`` sub-axes, and *plot_number* is used to identify
727+
the particular subplot that this function is to create within the notional
728+
grid. *plot_number* starts at 1, increments across rows first and has a
729+
maximum of ``nrows * ncols``.
727730
728-
You can leave out the commas if *numRows* <= *numCols* <=
729-
*plotNum* < 10, as in::
731+
In the case when *nrows*, *ncols* and *plot_number* are all less than 10,
732+
a convenience exists, such that the a 3 digit number can be given instead,
733+
where the hundreds represent *nrows*, the tens represent *ncols* and the
734+
units represent *plot_number*. For instance::
730735
731-
subplot(211) # 2 rows, 1 column, first (upper) plot
736+
subplot(211)
732737
733-
``subplot(111)`` is the default axis.
738+
produces a subaxes in a figure which represents the top plot (i.e. the
739+
first) in a 2 row by 1 column notional grid (no grid actually exists,
740+
but conceptually this is how the returned subplot has been positioned).
734741
735-
``subplot()`` by itself is the same as ``subplot(111)``
742+
.. note::
736743
744+
Creating a new subplot with a position which is entirely inside a
745+
pre-existing axes will trigger the larger axes to be deleted::
737746
738-
New subplots that overlap old will delete the old axes. If you do
739-
not want this behavior, use
740-
:meth:`~matplotlib.figure.Figure.add_subplot` or the
741-
:func:`~matplotlib.pyplot.axes` command. Eg.::
747+
import matplotlib.pyplot as plt
748+
# plot a line, implicitly creating a subplot(111)
749+
plt.plot([1,2,3])
750+
# now create a subplot which represents the top plot of a grid
751+
# with 2 rows and 1 column. Since this subplot will overlap the
752+
# first, the plot (and its axes) previously created, will be removed
753+
plt.subplot(211)
754+
plt.plot(range(12))
755+
plt.subplot(212, axisbg='y') # creates 2nd subplot with yellow background
742756
743-
from pylab import *
744-
plot([1,2,3]) # implicitly creates subplot(111)
745-
subplot(211) # overlaps, subplot(111) is killed
746-
plot(rand(12), rand(12))
747-
subplot(212, axisbg='y') # creates 2nd subplot with yellow background
757+
If you do not want this behavior, use the
758+
:meth:`~matplotlib.figure.Figure.add_subplot` method or the
759+
:func:`~matplotlib.pyplot.axes` function instead.
748760
749761
Keyword arguments:
750762

lib/matplotlib/transforms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def _invalidate_internal(self, value, invalidating_node):
150150
if self.pass_through or status_changed:
151151
self._invalid = value
152152

153-
for parent in self._parents.itervalues():
153+
for parent in self._parents.values():
154154
parent._invalidate_internal(value=value,
155155
invalidating_node=self)
156156

0 commit comments

Comments
 (0)