Skip to content

Commit 3998a28

Browse files
committed
Use parent collections norm for constant arrays
When mirroring constant array the norm somehow end up being different for constant arrays. It's strange and seems to be something fairly low level in matplotlib. So as a fix, if plotting constant arrays use the parents norm for the mirrored collection.
1 parent 5d1a52e commit 3998a28

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mosaic/polypcolor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ def _mirror_polycollection(ax, collection, descriptor, array, **kwargs):
6464
mirrored_verts, array=array[mirrored_idxs], zorder=zorder, **kwargs
6565
)
6666

67+
if np.allclose(array, array[0], rtol=1e-8, atol=1e-10):
68+
norm = collection.norm
69+
6770
mirrored_collection.set_cmap(cmap)
6871
mirrored_collection.set_norm(norm)
6972
mirrored_collection.set_clim(vmin, vmax)

0 commit comments

Comments
 (0)