8000 Merge pull request #22080 from anntzer/style · matplotlib/matplotlib@0e08015 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e08015

Browse files
authored
Merge pull request #22080 from anntzer/style
Simple style(ish) fixes.
2 parents 7549f8c + e4f184c commit 0e08015

File tree

7 files changed

+9
-19
lines changed

7 files changed

+9
-19
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,10 +1709,9 @@ def _writeImg(self, data, id, smask=None):
17091709
if bit_depth is None or palette is None:
17101710
raise RuntimeError("invalid PNG header")
17111711
palette = palette[:num_colors * 3] # Trim padding
1712-
palette = pdfRepr(palette)
1713-
obj['ColorSpace'] = Verbatim(b'[/Indexed /DeviceRGB '
1714-
+ str(num_colors - 1).encode()
1715-
+ b' ' + palette + b']')
1712+
obj['ColorSpace'] = Verbatim(
1713+
b'[/Indexed /DeviceRGB %d %s]'
1714+
% (num_colors - 1, pdfRepr(palette)))
17161715
obj['BitsPerComponent'] = bit_depth
17171716
color_channels = 1
17181717
else:

lib/matplotlib/contour.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,10 +928,7 @@ def __init__(self, ax, *args,
928928
)
929929

930930
def get_transform(self):
931-
"""
932-
Return the :class:`~matplotlib.transforms.Transform`
933-
instance used by this ContourSet.
934-
"""
931+
"""Return the `.Transform` instance used by this ContourSet."""
935932
if self._transform is None:
936933
self._transform = self.axes.transData
937934
elif (not isinstance(self._transform, mtransforms.Transform)

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ def legend(self, *args, **kwargs):
10091009
To make a legend for all artists on all Axes, call this function with
10101010
an iterable of strings, one for each legend item. For example::
10111011
1012-
fig, (ax1, ax2) = plt.subplots(1, 2)
1012+
fig, (ax1, ax2) = plt.subplots(1, 2)
10131013
ax1.plot([1, 3, 5], color='blue')
10141014
ax2.plot([2, 4, 6], color='red')
10151015
fig.legend(['the blues', 'the reds'])

lib/matplotlib/mlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def _stride_windows(x, n, noverlap=0, axis=0):
271271
if axis == 0:
272272
return x[np.newaxis]
273273
else:
274-
return x[np.newaxis].transpose()
274+
return x[np.newaxis].T
275275
if n > x.size:
276276
raise ValueError('n cannot be greater than the length of x')
277277

lib/matplotlib/transforms.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,8 +2424,7 @@ def transform_non_affine(self, points):
24242424
elif not self._a.is_affine and self._b.is_affine:
24252425
return self._a.transform_non_affine(points)
24262426
else:
2427-
return self._b.transform_non_affine(
2428-
self._a.transform(points))
2427+
return self._b.transform_non_affine(self._a.transform(points))
24292428

24302429
def transform_path_non_affine(self, path):
24312430
# docstring inherited

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,7 @@ def draw(self, renderer):
609609
if self._grid_helper is not None:
610610
self._grid_helper.update_lim(self.axes)
611611
gl = self._grid_helper.get_gridlines(self._which, self._axis)
612-
if gl:
613-
self.set_segments([np.transpose(l) for l in gl])
614-
else:
615-
self.set_segments([])
612+
self.set_segments([np.transpose(l) for l in gl])
616613
super().draw(renderer)
617614

618615

lib/mpl_toolkits/axisartist/floating_axes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ def get_boundary(self):
293293
Return (N, 2) array of (x, y) coordinate of the boundary.
294294
"""
295295
x0, x1, y0, y1 = self._extremes
296-
tr = self._aux_trans
297296

298297
xx = np.linspace(x0, x1, 100)
299298
yy0 = np.full_like(xx, y0)
@@ -304,9 +303,8 @@ def get_boundary(self):
304303

305304
xxx = np.concatenate([xx[:-1], xx1[:-1], xx[-1:0:-1], xx0])
306305
yyy = np.concatenate([yy0[:-1], yy[:-1], yy1[:-1], yy[::-1]])
307-
t = tr.transform(np.array([xxx, yyy]).transpose())
308306

309-
return t
307+
return self._aux_trans.transform(np.column_stack([xxx, yyy]))
310308

311309

312310
class FloatingAxesBase:

0 commit comments

Comments
 (0)
0