Skip to content

Commit

Permalink
fix divergent
Browse files Browse the repository at this point in the history
  • Loading branch information
RondeauG committed Nov 9, 2023
1 parent 6f24a34 commit 7fcc94d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions figanos/matplotlib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,14 +1001,14 @@ def custom_cmap_norm(

# center
center = None
if divergent:
if divergent is not None:
if divergent is True:
center = 0
else:
center = divergent

# build norm with options
if levels and center and isinstance(levels, int):
if center is not None and isinstance(levels, int):
if levels % 2 == 1:
half_levels = int((levels + 1) / 2) + 1
else:
Expand All @@ -1025,7 +1025,7 @@ def custom_cmap_norm(
if linspace_out:
return lin

elif levels:
elif levels is not None:
if isinstance(levels, list):
norm = matplotlib.colors.BoundaryNorm(boundaries=levels, ncolors=cmap.N)
else:
Expand All @@ -1035,7 +1035,7 @@ def custom_cmap_norm(
if linspace_out:
return lin

elif center:
elif center is not None:
norm = matplotlib.colors.TwoSlopeNorm(center, vmin=rvmin, vmax=rvmax)
else:
norm = matplotlib.colors.Normalize(rvmin, rvmax)
Expand Down

0 comments on commit 7fcc94d

Please sign in to comment.