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

Skip to content

Commit 7c2bc4c

Browse files
committed
Minor fixes following comments.
1 parent d3e7cc6 commit 7c2bc4c

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

examples/pylab_examples/figimage_demo.py

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

1010

1111
fig = plt.figure()
12-
Z = np.arange(10000).reshape(100, 100)
12+
Z = np.arange(10000).reshape((100, 100))
1313
Z[:, 50:] = 1
1414

1515
im1 = fig.figimage(Z, xo=50, yo=0, origin='lower')

examples/pylab_examples/mri_with_eeg.py

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

1717
# Load the MRI data (256x256 16 bit integers)
1818
dfile = cbook.get_sample_data('s1045.ima.gz')
19-
im = np.fromstring(dfile.read(), np.uint16).astype(float).reshape((256, 256))
19+
im = np.fromstring(dfile.read(), np.uint16).reshape((256, 256))
2020
dfile.close()
2121

2222
# Plot the MRI image

lib/matplotlib/backends/backend_pdf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,8 @@ def close(self):
560560
{val[0]: val[1] for val in six.itervalues(self.alphaStates)})
561561
self.writeHatches()
562562
self.writeGouraudTriangles()
563-
xobjects = dict(x[1:] for x in six.itervalues(self._images))
563+
xobjects = {
564+
name: ob for image, name, ob in six.itervalues(self._images)}
564565
for tup in six.itervalues(self.markers):
565566
xobjects[tup[0]] = tup[1]
566567
for name, value in six.iteritems(self.multi_byte_charprocs):

lib/matplotlib/cbook.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,16 +2068,10 @@ def unmasked_index_ranges(mask, compressed=True):
20682068
ic1 = breakpoints
20692069
return np.concatenate((ic0[:, np.newaxis], ic1[:, np.newaxis]), axis=1)
20702070

2071-
# a dict to cross-map linestyle arguments
2072-
_linestyles = [('-', 'solid'),
2073-
('--', 'dashed'),
2074-
('-.', 'dashdot'),
2075-
(':', 'dotted')]
2076-
2077-
ls_mapper = dict(_linestyles)
2078-
# The ls_mapper maps short codes for line style to their full name used
2079-
# by backends
2080-
# The reverse mapper is for mapping full names to short ones
2071+
2072+
# The ls_mapper maps short codes for line style to their full name used by
2073+
# backends; the reverse mapper is for mapping full names to short ones.
2074+
ls_mapper = {'-': 'solid', '--': 'dashed', '-.': 'dashdot', ':': 'dotted'}
20812075
ls_mapper_r = reverse_dict(ls_mapper)
20822076

20832077

lib/matplotlib/quiver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ def _make_verts(self, U, V):
657657
theta = np.angle(uv)
658658
else:
659659
theta = ma.masked_invalid(np.deg2rad(self.angles)).filled(0)
660-
theta = theta.reshape((-1, 1)) # for broadcasting
660+
theta = theta.reshape((-1, 1)) # for broadcasting
661661
xy = (X + Y * 1j) * np.exp(1j * theta) * self.width
662662
xy = xy[:, :, np.newaxis]
663663
XY = np.concatenate((xy.real, xy.imag), axis=2)

lib/matplotlib/ticker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,8 +1623,9 @@ def view_limits(self, vmin, vmax):
16231623
vmax += 1
16241624

16251625
if rcParams['axes.autolimit_mode'] == 'round_numbers':
1626-
exponent = round(math.log10(vmax - vmin)
1627-
/ math.log10(max(self.numticks - 1, 1))) - 1
1626+
exponent, remainder = _divmod(
1627+
math.log10(vmax - vmin), math.log10(max(self.numticks - 1, 1)))
1628+
exponent -= (remainder < .5)
16281629
scale = max(self.numticks - 1, 1) ** (-exponent)
16291630
vmin = math.floor(scale * vmin) / scale
16301631
vmax = math.ceil(scale * vmax) / scale

0 commit comments

Comments
 (0)