8000 Merge branch 'master' into imagegrid_edge_cbar · matplotlib/matplotlib@d91c893 · GitHub
[go: up one dir, main page]

Skip to content

Commit d91c893

Browse files
committed
Merge branch 'master' into imagegrid_edge_cbar
Conflicts: lib/matplotlib/__init__.py
2 parents a084e80 + d8b2924 commit d91c893

29 files changed

+250
-138
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Tighted input validation on 'pivot' kwarg to quiver
2+
```````````````````````````````````````````````````
3+
4+
Tightened validation so that only {'tip', 'tail', 'mid', and 'middle'}
5+
(but any capitalization) are valid values for the 'pivot' kwarg in
6+
the `Quiver.__init__` (and hence `Axes.quiver` and
7+
`plt.quiver` which both fully delegate to `Quiver`). Previously any
8+
input matching 'mid.*' would be interpreted as 'middle', 'tip.*' as
9+
'tip' and any string not matching one of those patterns as 'tail'.
10+
11+
The value of `Quiver.pivot` is normalized to be in the set {'tip',
12+
'tail', 'middle'} in `Quiver.__init__`.

doc/api/api_changes/code_removal.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Code Removal
2+
````````````
3+
4+
Legend
5+
------
6+
Removed handling of `loc 9E88 ` as a positional argument to `Legend`

doc/pyplots/text_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15)
1818

19-
ax.text(3, 2, unicode('unicode: Institut f\374r Festk\366rperphysik', 'latin-1'))
19+
ax.text(3, 2, u'unicode: Institut f\374r Festk\366rperphysik')
2020

2121
ax.text(0.95, 0.01, 'colored text in axes coords',
2222
verticalalignment='bottom', horizontalalignment='right',

doc/pyplots/whats_new_99_spines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
def adjust_spines(ax,spines):
7-
for loc, spine in ax.spines.iteritems():
7+
for loc, spine in ax.spines.items():
88
if loc in spines:
99
spine.set_position(('outward',10)) # outward by 10 points
1010
else:

doc/users/plotting/colormaps/Lfunction.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with the binary matplotlib colormap, too. Trying to show the difference between
44
adding blackness to a color at different rates.
55
'''
6-
6+
from __future__ import print_function
77
import numpy as np
88
import matplotlib.pyplot as plt
99
import colorconv as color
@@ -39,10 +39,10 @@
3939

4040
# Alter successive rows with more black
4141
k = 1
42-
for i in xrange(red.shape[1]):
42+
for i in range(red.shape[1]):
4343
# more blackness is closer to 0 than one, and in first column of LAB
4444
lab_add[0,i,0] = lab_add[0,i,0] - 10*i
45-
print i,k
45+
print(i,k)
4646
if i != 0:
4747
lab_geometric[0,i,0] = lab_geometric[0,i,0] - 10*k
4848
k *= 2
@@ -57,15 +57,15 @@
5757

5858
fig = plt.figure()
5959
k = 1
60-
for i in xrange(red.shape[1]):
60+
for i in range(red.shape[1]):
6161

6262
# LHS: additive
6363
ax1 = fig.add_subplot(nrows,2,i*2+1, axisbg=tuple(rgb_add[0,i,:]))
64-
print tuple(lab_add[0,i,:])#, tuple(rgb_add[0,i,:])
64+
print(tuple(lab_add[0,i,:]))#, tuple(rgb_add[0,i,:])
6565

6666
# RHS: multiplicative
6767
ax2 = fig.add_subplot(nrows,2,i*2+2, axisbg=tuple(rgb_geometric[0,i,:]))
68-
print tuple(lab_geometric[0,i,:])#, tuple(rgb_geometric[0,i,:])
68+
print(tuple(lab_geometric[0,i,:]))#, tuple(rgb_geometric[0,i,:])
6969

7070
# ylabels
7171
if i!=0:
@@ -117,24 +117,24 @@
117117
k = 1
118118
di = 8
119119
I0 = 5
120-
for i in xrange(nrows):
120+
for i in range(nrows):
121121
# Do more blackness via increasing indices
122122
rgb_add[:,i,:] = rgb[:,i*di+I0,:]
123123

124124
if i != 0:
125-
print i*di+I0, di*k+I0, (I0**(1./3)+i*di**(1./3))**3
125+
print(i*di+I0, di*k+I0, (I0**(1./3)+i*di**(1./3))**3)
126126
rgb_geometric[:,i,:] = rgb[:,I0+di*k,:]
127127
k *= 2
128128
elif i==0:
129-
print i*di+I0, I0, (I0**(1./3)+i*di**(1./3))**3
129+
print(i*di+I0, I0, (I0**(1./3)+i*di**(1./3))**3)
130130
rgb_geometric[:,i,:] = rgb[:,I0,:]
131131

132132
lab_add = color.rgb2lab(rgb_add)
133133
lab_geometric = color.rgb2lab(rgb_geometric)
134134

135135
fig = plt.figure()
136136
k = 1
137-
for i in xrange(nrows):
137+
for i in range(nrows):
138138

139139
# LHS: additive
140140
ax1 = fig.add_subplot(nrows,ncols,i*2+1, axisbg=tuple(rgb_add[0,i,:]))

doc/users/plotting/colormaps/lightness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
fig = plt.figure(figsize=(11.5,4*nsubplots))
6060

61-
for i, subplot in enumerate(xrange(nsubplots)):
61+
for i, subplot in enumerate(range(nsubplots)):
6262

6363
locs = [] # locations for text labels
6464

doc/users/plotting/examples/demo_gridspec06.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def squiggle_xy(a, b, c, d, i=np.arange(0.0, 2*np.pi, 0.05)):
2323
# gridspec inside gridspec
2424
outer_grid = gridspec.GridSpec(4, 4, wspace=0.0, hspace=0.0)
2525

26-
for i in xrange(16):
26+
for i in range(16):
2727
inner_grid = gridspec.GridSpecFromSubplotSpec(3, 3,
2828
subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0)
2929
a, b = int(i/4)+1,i%4+1

examples/api/skewt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _set_lim_and_transforms(self):
146146
# Now make a simple example using the custom projection.
147147
from matplotlib.ticker import ScalarFormatter, MultipleLocator
148148
import matplotlib.pyplot as plt
149-
from StringIO import StringIO
149+
from six import StringIO
150150
import numpy as np
151151

152152
# Some examples data

examples/lines_bars_and_markers/marker_reference.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Reference for filled- and unfilled-marker types included with Matplotlib.
33
"""
4+
from six import iteritems
45
import numpy as np
56
import matplotlib.pyplot as plt
67
from matplotlib.lines import Line2D
@@ -32,9 +33,14 @@ def split_list(a_list):
3233
fig, axes = plt.subplots(ncols=2)
3334

3435
# Filter out filled markers and marker settings that do nothing.
35-
unfilled_markers = [m for m, func in Line2D.markers.iteritems()
36+
# We use iteritems from six to make sure that we get an iterator
37+
# in both python 2 and 3
38+
unfilled_markers = [m for m, func in iteritems(Line2D.markers)
3639
if func != 'nothing' and m not in Line2D.filled_markers]
37-
unfilled_markers = sorted(unfilled_markers)[::-1] # Reverse-sort for pretty
40+
# Reverse-sort for pretty. We use our own sort key which is essentially
41+
# a python3 compatible reimplementation of python2 sort.
42+
unfilled_markers = sorted(unfilled_markers,
43+
key=lambda x: (str(type(x)), str(x)))[::-1]
3844
for ax, markers in zip(axes, split_list(unfilled_markers)):
3945
for y, marker in enumerate(markers):
4046
ax.text(-0.5, y, nice_repr(marker), **text_style)

examples/pylab_examples/animation_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
y = np.arange(5)
1414
z = x * y[:, np.newaxis]
1515

16-
for i in xrange(5):
16+
for i in range(5):
1717
if i == 0:
1818
p = plt.imshow(z)
1919
fig = plt.gcf()

examples/pylab_examples/boxplot_demo2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@
5757
# Now fill the boxes with desired colors
5858
boxColors = ['darkkhaki', 'royalblue']
5959
numBoxes = numDists*2
60-
medians = range(numBoxes)
60+
medians = list(range(numBoxes))
6161
for i in range(numBoxes):
6262
box = bp['boxes'][i]
6363
boxX = []
6464
boxY = []
6565
for j in range(5):
6666
boxX.append(box.get_xdata()[j])
6767
boxY.append(box.get_ydata()[j])
68-
boxCoords = zip(boxX, boxY)
68+
boxCoords = list(zip(boxX, boxY))
6969
# Alternate between Dark Khaki and Royal Blue
7070
k = i % 2
7171
boxPolygon = Polygon(boxCoords, facecolor=boxColors[k])

examples/pylab_examples/logo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
datafile = cbook.get_sample_data('membrane.dat', asfileobj=False)
1010
print('loading', datafile)
1111

12-
x = 1000*0.1*fromstring(file(datafile, 'rb').read(), float32)
12+
x = 1000*0.1*fromstring(open(datafile, 'rb').read(), float32)
1313
# 0.0005 is the sample interval
1414
t = 0.0005*arange(len(x))
1515
figure(1, figsize=(7, 1), dpi=100)

examples/pylab_examples/multiple_yaxis_with_spines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
def make_patch_spines_invisible(ax):
55
ax.set_frame_on(True)
66
ax.patch.set_visible(False)
7-
for sp in ax.spines.itervalues():
7+
for sp in ax.spines.values():
88
sp.set_visible(False)
99

1010
fig, host = plt.subplots()

lib/matplotlib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,6 @@ def tk_window_focus():
13951395
'matplotlib.tests.test_arrow_patches',
13961396
'matplotlib.tests.test_artist',
13971397
'matplotlib.tests.test_axes',
1398-
'matplotlib.tests.test_axes_grid1',
13991398
'matplotlib.tests.test_backend_bases',
14001399
'matplotlib.tests.test_backend_pdf',
14011400
'matplotlib.tests.test_backend_pgf',
@@ -1440,8 +1439,9 @@ def tk_window_focus():
14401439
'matplotlib.tests.test_tightlayout',
14411440
'matplotlib.tests.test_transforms',
14421441
'matplotlib.tests.test_triangulation',
1443-
'mpl_toolkits.tests.test_mplot3d',
14441442
'matplotlib.tests.test_widgets',
1443+
'mpl_toolkits.tests.test_mplot3d',
1444+
'mpl_toolkits.tests.test_axes_grid1',
14451445
'mpl_toolkits.tests.test_axes_grid',
14461446
]
14471447

0 commit comments

Comments
 (0)
0