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

Skip to content

Commit 29ae631

Browse files
committed
FIX: Update AxesGrid colorbar test
This test clears out a previous colorbar axis and the norms were getting shared and updated between these images. To fix this, we can deepcopy the norm before creating the colorbar.
1 parent adcad36 commit 29ae631

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/mpl_toolkits/tests/test_axes_grid.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import copy
12
import numpy as np
23

34
import matplotlib as mpl
@@ -43,6 +44,9 @@ def test_imagegrid_cbar_mode_edge():
4344
# "second" ones. To achieve this, clear out the axes first.
4445
for ax in grid:
4546
ax.cax.cla()
47+
# We don't want to share the norms between the colorbar axes
48+
# so create a deepcopy for each image
49+
ax.images[0].norm = copy.deepcopy(ax.images[0].norm)
4650
cb = ax.cax.colorbar(
4751
ax.images[0],
4852
ticks=mpl.ticker.MaxNLocator(5)) # old default locator.

0 commit comments

Comments
 (0)