8000 Merge pull request #1 from matplotlib/master · matplotlib/matplotlib@d29582c · GitHub
[go: up one dir, main page]

Skip to content

Commit d29582c

Browse files
authored
Merge pull request #1 from matplotlib/master
Syncing recent changes on matplotlib/matplotlib
2 parents 2b6ad95 + 4ea916a commit d29582c

File tree

7 files changed

+49
-58
lines changed

7 files changed

+49
-58
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ env:
5656
- PANDAS=
5757
- JUPYTER=
5858
- PYPARSING=pyparsing
59-
- PYTEST='pytest>=3.4'
59+
# pytest-timeout master depends on pytest>=3.6. Testing with pytest 3.4 is
60+
# still supported; this is tested by the first matrix entry.
61+
- PYTEST='pytest>=3.6'
6062
- PYTEST_COV=pytest-cov
6163
- PYTEST_PEP8=
64+
- PYTEST_TIMEOUT=pytest-timeout
6265
- SPHINX=sphinx
6366
# Variables controlling the build.
6467
- MPLLOCALFREETYPE=1
@@ -87,6 +90,7 @@ matrix:
8790
- PYPARSING=pyparsing==2.0.1
8891
- PYTEST=pytest==3.4
8992
- PYTEST_COV=pytest-cov==2.3.1
93+
- PYTEST_TIMEOUT=pytest-timeout==1.2.1 # Newer pytest-timeouts don't support pytest 3.4.
9094
- SPHINX=sphinx==1.3
9195
- python: 3.5
9296
env:
@@ -180,7 +184,7 @@ install:
180184
pytest-faulthandler \
181185
$PYTEST_PEP8 \
182186
pytest-rerunfailures \
183-
pytest-timeout \
187+
$PYTEST_TIMEOUT \
184188
pytest-xdist
185189
- |
186190
# Install matplotlib

examples/scales/log_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
ax4.set(title='Errorbars go negative')
4141
ax4.errorbar(x, y, xerr=0.1 * x, yerr=5.0 + 0.75 * y)
4242
# ylim must be set after errorbar to allow errorbar to autoscale limits
43-
ax4.set_ylim(ymin=0.1)
43+
ax4.set_ylim(bottom=0.1)
4444

4545
fig.tight_layout()
4646
plt.show()

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7423,8 +7423,8 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
74237423
marker=marker, markersize=markersize, **kwargs)
74247424
self.add_line(marks)
74257425
nr, nc = Z.shape
7426-
self.set_xlim(xmin=-0.5, xmax=nc - 0.5)
7427-
self.set_ylim(ymin=nr - 0.5, ymax=-0.5)
7426+
self.set_xlim(-0.5, nc - 0.5)
7427+
self.set_ylim(nr - 0.5, -0.5)
74287428
self.set_aspect(aspect)
74297429
ret = marks
74307430
self.title.set_y(1.05)

lib/matplotlib/backend_bases.py

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ def __init__(self, name, canvas, guiEvent=None):
13321332

13331333
class LocationEvent(Event):
13341334
"""
1335-
An event that has a screen location
1335+
An event that has a screen location.
13361336
13371337
The following additional attributes are defined and shown with
13381338
their default values.
@@ -1356,28 +1356,23 @@ class LocationEvent(Event):
13561356
13571357
ydata : scalar
13581358
y coord of mouse in data coords
1359-
13601359
"""
1361-
x = None # x position - pixels from left of canvas
1362-
y = None # y position - pixels from right of canvas
1363-
inaxes = None # the Axes instance if mouse us over axes
1364-
xdata = None # x coord of mouse in data coords
1365-
ydata = None # y coord of mouse in data coords
13661360

1367-
# the last event that was triggered before this one
1368-
lastevent = None
1361+
lastevent = None # the last event that was triggered before this one
13691362

13701363
def __init__(self, name, canvas, x, y, guiEvent=None):
13711364
"""
13721365
*x*, *y* in figure coords, 0,0 = bottom, left
13731366
"""
13741367
Event.__init__(self, name, canvas, guiEvent=guiEvent)
1375-
self.x = x
1376-
self.y = y
1368+
self.x = x # x position - pixels from left of canvas
1369+
self.y = y # y position - pixels from right of canvas
1370+
self.inaxes = None # the Axes instance if mouse us over axes
1371+
self.xdata = None # x coord of mouse in data coords
1372+
self.ydata = None # y coord of mouse in data coords
13771373

13781374
if x is None or y is None:
13791375
# cannot check if event was in axes if no x,y info
1380-
self.inaxes = None
13811376
self._update_enter_leave()
13821377
return
13831378

@@ -1394,13 +1389,10 @@ def __init__(self, name, canvas, x, y, guiEvent=None):
13941389
trans = self.inaxes.transData.inverted()
13951390
xdata, ydata = trans.transform_point((x, y))
13961391
except ValueError:
1397-
self.xdata = None
1398-
self.ydata = None
1392+
pass
13991393
else:
14001394
self.xdata = xdata
14011395
self.ydata = ydata
1402-
else:
1403-
self.inaxes = None
14041396

14051397
self._update_enter_leave()
14061398

@@ -1443,18 +1435,21 @@ class MouseEvent(LocationEvent):
14431435
14441436
Attributes
14451437
----------
1446-
button : None, scalar, or str
1447-
button pressed None, 1, 2, 3, 'up', 'down' (up and down are used
1448-
for scroll events). Note that in the nbagg backend, both the
1449-
middle and right clicks return 3 since right clicking will bring
1450-
up the context menu in some browsers.
1438+
button : {None, 1, 2, 3, 'up', 'down'}
1439+
The button pressed. 'up' and 'down' are used for scroll events.
1440+
Note that in the nbagg backend, both the middle and right clicks
1441+
return 3 since right clicking will bring up the context menu in
1442+
some browsers.
14511443
1452-
key : None, or str
1453-
the key depressed when the mouse event triggered (see
1454-
:class:`KeyEvent`)
1444+
key : None or str
1445+
The key pressed when the mouse event triggered, e.g. 'shift'.
1446+
See `KeyEvent`.
14551447
14561448
step : scalar
1457-
number of scroll steps (positive for 'up', negative for 'down')
1449+
The Number of scroll steps (positive for 'up', negative for 'down').
1450+
1451+
dblclick : bool
1452+
*True* if the event is a double-click.
14581453
14591454
Examples
14601455
--------
@@ -1464,16 +1459,7 @@ def on_press(event):
14641459
print('you pressed', event.button, event.xdata, event.ydata)
14651460
14661461
cid = fig.canvas.mpl_connect('button_press_event', on_press)
1467-
14681462
"""
1469-
x = None # x position - pixels from left of canvas
1470-
y = None # y position - pixels from right of canvas
1471-
button = None # button pressed None, 1, 2, 3
1472-
dblclick = None # whether or not the event is the result of a double click
1473-
inaxes = None # the Axes instance if mouse us over axes
1474-
xdata = None # x coord of mouse in data coords
1475-
ydata = None # y coord of mouse in data coords
1476-
step = None # scroll steps for scroll events
14771463

14781464
def __init__(self, name, canvas, x, y, button=None, key=None,
14791465
step=0, dblclick=False, guiEvent=None):

lib/matplotlib/pyplot.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,20 +1310,21 @@ def xlim(*args, **kwargs):
13101310
13111311
Call signatures::
13121312
1313-
xmin, xmax = xlim() # return the current xlim
1314-
xlim((xmin, xmax)) # set the xlim to xmin, xmax
1315-
xlim(xmin, xmax) # set the xlim to xmin, xmax
1313+
left, right = xlim() # return the current xlim
1314+
xlim((left, right)) # set the xlim to left, right
1315+
xlim(left, right) # set the xlim to left, right
13161316
1317-
If you do not specify args, you can pass *xmin* or *xmax* as kwargs, i.e.::
1317+
If you do not specify args, you can pass *left* or *right* as kwargs,
1318+
i.e.::
13181319
1319-
xlim(xmax=3) # adjust the max leaving min unchanged
1320-
xlim(xmin=1) # adjust the min leaving max unchanged
1320+
xlim(right=3) # adjust the right leaving left unchanged
1321+
xlim(left=1) # adjust the left leaving right unchanged
13211322
13221323
Setting limits turns autoscaling off for the x-axis.
13231324
13241325
Returns
13251326
-------
1326-
xmin, xmax
1327+
left, right
13271328
A tuple of the new x-axis limits.
13281329
13291330
Notes
@@ -1346,21 +1347,21 @@ def ylim(*args, **kwargs):
13461347
13471348
Call signatures::
13481349
1349-
ymin, ymax = ylim() # return the current ylim
1350-
ylim((ymin, ymax)) # set the ylim to ymin, ymax
1351-
ylim(ymin, ymax) # set the ylim to ymin, ymax
1350+
bottom, top = ylim() # return the current ylim
1351+
ylim((bottom, top)) # set the ylim to bottom, top
1352+
ylim(bottom, top) # set the ylim to bottom, top
13521353
1353-
If you do not specify args, you can alternatively pass *ymin* or *ymax* as
1354-
kwargs, i.e.::
1354+
If you do not specify args, you can alternatively pass *bottom* or
1355+
*top* as kwargs, i.e.::
13551356
1356-
ylim(ymax=3) # adjust the max leaving min unchanged
1357-
ylim(ymin=1) # adjust the min leaving max unchanged
1357+
ylim(top=3) # adjust the top leaving bottom unchanged
1358+
ylim(bottom=1) # adjust the top leaving bottom unchanged
13581359
13591360
Setting limits turns autoscaling off for the y-axis.
13601361
13611362
Returns
13621363
-------
1363-
ymin, ymax
1364+
bottom, top
13641365
A tuple of the new y-axis limits.
13651366
13661367
Notes

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ def test_hist_step_filled():
15771577
for kg, _type, ax in zip(kwargs, types, axes):
15781578
ax.hist(x, n_bins, histtype=_type, stacked=True, **kg)
15791579
ax.set_title('%s/%s' % (kg, _type))
1580-
ax.set_ylim(ymin=-50)
1580+
ax.set_ylim(bottom=-50)
15811581

15821582
patches = axes[0].patches
15831583
assert all(p.get_facecolor() == p.get_edgecolor() for p in patches)

lib/matplotlib/tests/test_simplification.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_overflow():
3333

3434
fig, ax = plt.subplots()
3535
ax.plot(x, y)
36-
ax.set_xlim(xmin=2, xmax=6)
36+
ax.set_xlim(2, 6)
3737

3838

3939
@image_comparison(baseline_images=['clipping_diamond'], remove_text=True)
@@ -43,8 +43,8 @@ def test_diamond():
4343

4444
fig, ax = plt.subplots()
4545
ax.plot(x, y)
46-
ax.set_xlim(xmin=-0.6, xmax=0.6)
47-
ax.set_ylim(ymin=-0.6, ymax=0.6)
46+
ax.set_xlim(-0.6, 0.6)
47+
ax.set_ylim(-0.6, 0.6)
4848

4949

5050
def test_noise():

0 commit comments

Comments
 (0)
0