GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — minor bugfixes · matplotlib/matplotlib@c353303

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/matplotlib
    • colorbar.py
    • figure.py
    • tests
      • test_colorbar.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/matplotlib/colorbar.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/colorbar.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
major_pad : float
187187
Spacing between colorbars along the long axis
188188
189-
major_pad : float
189+
minor_pad : float
190190
Spacing between colorbars along the short axis
191191
""")
192192

@@ -1792,7 +1792,7 @@ def remove(self):
17921792
except AttributeError:
17931793
return
17941794
try:
1795-
subplotspec = self.ax.get_subplotspec().get_gridspec()._subplot_spec
1795+
subplotspec = ax.get_subplotspec().get_gridspec()._subplot_spec
17961796
except AttributeError: # use_gridspec was False
17971797
pos = ax.get_position(original=True)
17981798
ax._set_position(pos)
@@ -1926,7 +1926,7 @@ def _get_tight_packing_inside(self, bbox):
19261926
else:
19271927
raise ValueError("_set_tight_packing cannot be called "
19281928
"unless the MultivarColorbar was created "
1929-
"by fig.multicolorbar(mappable).")
1929+
"by fig.colorbar_multivar(mappable).")
19301930

19311931
def _get_original_position(self):
19321932
# comparable to axes.get_position(original=True)
@@ -2233,6 +2233,7 @@ def make_multivar_axes(parents, n_variates, n_major, location=None, orientation=
22332233
22342234
n_major : int
22352235
Number of colorbars along the long axis of the colorbars
2236+
If -1, all colorbars are places sequentially along the long axis.
22362237
%(_make_multivar_axes_kw_doc)s
22372238
22382239
Returns
Collapse file

‎lib/matplotlib/figure.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,12 +1356,13 @@ def colorbar(
13561356
13571357
"""
13581358
if isinstance(mappable.cmap, mcolors.BivarColormap):
1359-
raise ValueError("`Figure.colorbar` can only be together with a "
1360-
"scalar colormap, please use `Figure.colorbar_bivar` "
1359+
raise ValueError("`Figure.colorbar` can only be together with a scalar "
1360+
"colormap, please use `Figure.colorbar_bivar` "
13611361
"when working with a bivariate colormap")
13621362
if isinstance(mappable.cmap, mcolors.MultivarColormap):
1363-
raise ValueError("colorbar can only be together with a"
1364-
"scalar colormap")
1363+
raise ValueError("colorbar can only be together with a scalar "
1364+
"colormap, please use `Figure.colorbar_multivar` "
1365+
"when working with a bivariate colormap")
13651366

13661367
if ax is None:
13671368
ax = getattr(mappable, "axes", None)
@@ -1528,6 +1529,10 @@ def colorbar_multivar(
15281529
Defaults to the Axes that contains the mappable used to create the
15291530
colorbar.
15301531
1532+
n_major : int
1533+
Number of colorbars along the long axis of the colorbars.
1534+
If -1, all colorbars are places sequentially along the long axis.
1535+
15311536
Returns
15321537
-------
15331538
multivariate_colorbar : `~matplotlib.colorbar.MultivarColorbar`
Collapse file

‎lib/matplotlib/tests/test_colorbar.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colorbar.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,8 +1583,8 @@ def test_bivar_cbar_ticklocations():
15831583
with pytest.raises(ValueError, match='ticklocations must be a tuple of'):
15841584
cbar = fig.colorbar_bivar(ca, cax=ax, ticklocations=['left'])
15851585
cbar = fig.colorbar_bivar(ca, cax=ax, ticklocations=['left', 'top'])
1586-
cbar.ax.yaxis.get_label_position() == 'left'
1587-
cbar.ax.xaxis.get_label_position() == 'top'
1586+
assert cbar.ax.yaxis.get_label_position() == 'left'
1587+
assert cbar.ax.xaxis.get_label_position() == 'top'
15881588

15891589

15901590
def test_wrong_kind_colorbar():
@@ -1757,7 +1757,11 @@ def test_multivar_cbar_set_label_limits():
17571757
fig, ax = plt.subplots(1, 1)
17581758
mim = ax.imshow(data, cmap='3VarAddA')
17591759
cbs = fig.colorbar_multivar(mim)
1760-
cbs[0].set_label('A')
17611760
assert len(cbs) == 3
1761+
cbs[0].set_label('A')
1762+
assert cbs[0].ax.get_ylabel() == 'A'
1763+
17621764
mim.norm.vmin = (-1, -1, -1)
17631765
mim.norm.vmax = (1, 2, 3)
1766+
np.testing.assert_allclose(cbs[0].ax.get_ylim(), (-1, 1))
1767+
np.testing.assert_allclose(cbs[2].ax.get_ylim(), (-1, 3))

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.