Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f739c48

Browse filesBrowse files
committed
FIX: review fixes
1 parent b39bc69 commit f739c48
Copy full SHA for f739c48

File tree

Expand file treeCollapse file tree

2 files changed

+21
-14
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+21
-14
lines changed

‎lib/matplotlib/colorbar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colorbar.py
+16-8Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,8 @@ def draw_all(self):
517517
# Compute the X/Y mesh.
518518
X, Y, extendlen = self._mesh()
519519
# draw the extend triangles, and shrink the inner axes to accomodate.
520-
# returns the outline of the axes in axes-relative units, including
521-
# the extends:
522-
xyout = self._do_extends(extendlen)
523-
# set the spine outline from the above:
524-
self.outline.set_xy(xyout)
520+
# also adds the outline path to self.outline spine:
521+
self._do_extends(extendlen)
525522

526523
self.ax.set_xlim(self.vmin, self.vmax)
527524
self.ax.set_ylim(self.vmin, self.vmax)
@@ -611,8 +608,10 @@ def _do_extends(self, extendlen):
611608
xyout = xyout[:, ::-1]
612609
self.ax._set_inner_bounds(bounds)
613610

611+
# xyout is the path for the spine:
612+
self.outline.set_xy(xyout)
614613
if not self.filled:
615-
return xyout
614+
return
616615

617616
# Make extend triangles or rectangles filled patches. These are
618617
# defined in the outer parent axes' co-ordinates:
@@ -655,7 +654,7 @@ def _do_extends(self, extendlen):
655654
linewidth=0, antialiased=False,
656655
transform=self.ax.outer_ax.transAxes, hatch=hatches[-1])
657656
self.ax.outer_ax.add_patch(patch)
658-
return xyout
657+
return
659658

660659
def add_lines(self, levels, colors, linewidths, erase=True):
661660
"""
@@ -796,7 +795,7 @@ def set_ticks(self, ticks, update_ticks=True):
796795

797796
def get_ticks(self, minor=False):
798797
"""
799-
Return the x ticks as a list of locations.
798+
Return the ticks as a list of locations.
800799
801800
Parameters
802801
----------
@@ -813,8 +812,17 @@ def set_ticklabels(self, ticklabels, update_ticks=True):
813812
"""
814813
Set tick labels.
815814
815+
Parameters
816+
----------
817+
818+
ticklabels : sequence of str or of `.Text`
819+
Texts for labeling each tick location in the sequence set by
820+
`.Axis.set_ticks`; the number of labels must match the number of
821+
locations.
822+
816823
update_ticks : bool, default: True
817824
This keyword argument is ignored and will be be removed.
825+
Deprecated
818826
"""
819827
if isinstance(self.locator, ticker.FixedLocator):
820828
self.formatter = ticker.FixedFormatter(ticklabels)

‎lib/matplotlib/tests/test_colorbar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colorbar.py
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ def _colorbar_extension_length(spacing):
8888
# Create a subplot.
8989
cax = fig.add_subplot(12, 1, i*3 + j + 1)
9090
# Generate the colorbar.
91-
cb = ColorbarBase(cax, cmap=cmap, norm=norm,
92-
boundaries=boundaries, values=values,
93-
extend=extension_type, extendfrac=extendfrac,
94-
orientation='horizontal', spacing=spacing)
91+
ColorbarBase(cax, cmap=cmap, norm=norm,
92+
boundaries=boundaries, values=values,
93+
extend=extension_type, extendfrac=extendfrac,
94+
orientation='horizontal', spacing=spacing)
9595
# Turn off text and ticks.
9696
cax.tick_params(left=False, labelleft=False,
9797
bottom=False, labelbottom=False)
@@ -310,7 +310,6 @@ def test_colorbar_minorticks_on_off():
310310

311311
im.set_clim(vmin=-1.2, vmax=1.2)
312312
cbar.minorticks_on()
313-
#fig.canvas.draw()
314313
np.testing.assert_almost_equal(
315314
cbar.ax.yaxis.get_minorticklocs(),
316315
[-1.1, -0.9, -0.8, -0.7, -0.6, -0.4, -0.3, -0.2, -0.1,
@@ -433,7 +432,7 @@ def test_colorbar_get_ticks():
433432
assert userTicks.get_ticks().tolist() == [600, 700, 800]
434433

435434
# testing for getter after calling set_ticks with some ticks out of bounds
436-
# removed #18900: other axes don't trim fixed lists, so colorbars
435+
# removed #20054: other axes don't trim fixed lists, so colorbars
437436
# should not either:
438437
# userTicks.set_ticks([600, 1300, 1400, 1500])
439438
# assert userTicks.get_ticks().tolist() == [600]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.