Skip to content

Commit 5daa8f4

Browse files
authored
update colorbar tests (#40)
* update colorbar tests * refactor and fix * changelog * also test ax=ax
1 parent 3b6d175 commit 5daa8f4

File tree

3 files changed

+257
-153
lines changed

3 files changed

+257
-153
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
### Bug fixes
1717

1818
* Fixed compatibility of `mpu.colorbar` with `bbox_inches="tight"` for matplotlib 3.4 and
19-
newer ([#26](https://github.com/mathause/mplotutils/pull/26)).
19+
newer and refactor and extend tests ([#26](https://github.com/mathause/mplotutils/pull/26)
20+
and [#40](https://github.com/mathause/mplotutils/pull/40)).
2021

2122
### Internal changes
2223

mplotutils/_colorbar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def colorbar(
1414
pad=None,
1515
shift="symmetric",
1616
shrink=None,
17-
**kwargs
17+
**kwargs,
1818
):
1919
"""
2020
automatically resize colorbars on draw
@@ -389,7 +389,7 @@ def inner(event=None):
389389
height = size_scaled
390390
else:
391391
figure_aspect = np.divide(*f.get_size_inches())
392-
height = (width * figure_aspect) / (aspect)
392+
height = width * (aspect * figure_aspect)
393393

394394
left = posn1.x0 + shift * full_width
395395
bottom = posn1.y0 - (pad_scaled + height)

0 commit comments

Comments
 (0)