Skip to content

Commit

Permalink
Merge pull request #4 from neutrinoceros/hotfix_mpl_3.9_compat
Browse files Browse the repository at this point in the history
BUG: fix future compatibility with matplotlib 3.9
  • Loading branch information
agurvich committed Jan 23, 2024
2 parents 663350e + 17234f3 commit 408f0da
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'numpy',
'h5py',
'pandas',
'matplotlib'
'matplotlib>=3.5'
],
include_package_data=True,
options={"bdist_wheel": {"universal": True}}
Expand Down
35 changes: 18 additions & 17 deletions src/abg_python/pfh_colormaps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import matplotlib
from matplotlib.colors import LinearSegmentedColormap
import matplotlib as mpl

def load_my_custom_color_tables():
fna='heat_red'
Expand All @@ -7,60 +8,60 @@ def load_my_custom_color_tables():
'green': ((0., 0., 0.),(0.71, 0.000000, 0.000000),\
(1., 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'blue': ((0., 0., 0.),(0.71, 0.000000, 0.000000),(1.0, 1.0, 1.0))}
my_cmap = matplotlib.colors.LinearSegmentedColormap(fna,cdict_tmp,256);
matplotlib.cm.register_cmap(name=fna,cmap=my_cmap);
my_cmap = LinearSegmentedColormap(fna,cdict_tmp,256)
mpl.colormaps.register(name=fna,cmap=my_cmap)

fna='heat_blue'
cdict_tmp={\
'blue': ((0., 0.0416, 0.0416),(0.365079, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'green': ((0., 0., 0.),(0.365079, 0.000000, 0.000000),\
(0.746032, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'red': ((0., 0., 0.),(0.746032, 0.000000, 0.000000),(1.0, 1.0, 1.0))}
my_cmap = matplotlib.colors.LinearSegmentedColormap(fna,cdict_tmp,256);
matplotlib.cm.register_cmap(name=fna,cmap=my_cmap);
my_cmap = LinearSegmentedColormap(fna,cdict_tmp,256)
mpl.colormaps.register(name=fna,cmap=my_cmap)

fna='heat_green'
cdict_tmp={\
'green': ((0., 0.0416, 0.0416),(0.365079, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'red': ((0., 0., 0.),(0.365079, 0.000000, 0.000000),\
(1.000000, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'blue': ((0., 0., 0.),(0.1, 0.000000, 0.000000),(1.0, 1.0, 1.0))}
my_cmap = matplotlib.colors.LinearSegmentedColormap(fna,cdict_tmp,256);
matplotlib.cm.register_cmap(name=fna,cmap=my_cmap);
my_cmap = LinearSegmentedColormap(fna,cdict_tmp,256)
mpl.colormaps.register(name=fna,cmap=my_cmap)

fna='heat_redyellow'
cdict_tmp={\
'red': ((0., 0.0416, 0.0416),(0.365079, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'green': ((0., 0., 0.),(0.365079, 0.000000, 0.000000),\
(0.746032, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'blue': ((0., 0., 0.),(0.746032, 0.000000, 0.000000),(1.0, 1.0, 1.0))}
my_cmap = matplotlib.colors.LinearSegmentedColormap(fna,cdict_tmp,256);
matplotlib.cm.register_cmap(name=fna,cmap=my_cmap);
my_cmap = LinearSegmentedColormap(fna,cdict_tmp,256)
mpl.colormaps.register(name=fna,cmap=my_cmap)

fna='heat_yellow'
cdict_tmp={\
'red': ((0., 0.0416, 0.0416),(0.365079, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'green': ((0., 0.0416, 0.0416),(0.365079, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'blue': ((0., 0., 0.),(0.746032, 0.000000, 0.000000),(1.0, 1.0, 1.0))}
my_cmap = matplotlib.colors.LinearSegmentedColormap(fna,cdict_tmp,256);
matplotlib.cm.register_cmap(name=fna,cmap=my_cmap);
my_cmap = LinearSegmentedColormap(fna,cdict_tmp,256)
mpl.colormaps.register(name=fna,cmap=my_cmap)

fna='heat_purple'
cdict_tmp={\
'red': ((0., 0.0416, 0.0416),(0.565079, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'green': ((0., 0., 0.),(0.565079, 0.000000, 0.000000),\
(0.946032, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'blue': ((0., 0.0416, 0.0416),(0.565079, 1.000000, 1.000000),(1.0, 1.0, 1.0))}
my_cmap = matplotlib.colors.LinearSegmentedColormap(fna,cdict_tmp,256);
matplotlib.cm.register_cmap(name=fna,cmap=my_cmap);
my_cmap = LinearSegmentedColormap(fna,cdict_tmp,256)
mpl.colormaps.register(name=fna,cmap=my_cmap)

fna='heat_orange'
cdict_tmp={\
'red': ((0., 0.0416, 0.0416),(0.365079, 1.000000, 1.000000),(1.0, 1.0, 1.0)),\
'green': ((0., 0.0416, 0.0416),(0.365079, 0.400000, 0.400000),(1.0, 1.0, 1.0)),\
'blue': ((0., 0., 0.),(0.746032, 0.000000, 0.000000),(1.0, 1.0, 1.0))}
my_cmap = matplotlib.colors.LinearSegmentedColormap(fna,cdict_tmp,256);
matplotlib.cm.register_cmap(name=fna,cmap=my_cmap);
my_cmap = LinearSegmentedColormap(fna,cdict_tmp,256)
mpl.colormaps.register(name=fna,cmap=my_cmap)

"""
fna='rainbow'
Expand All @@ -80,6 +81,6 @@ def load_my_custom_color_tables():
(0.4, 0.0, 0.0),
(0.6, 20/256., 20/256.),
(1.0, 0.0, 0.0))}
my_cmap = matplotlib.colors.LinearSegmentedColormap(fna,cdict_tmp,256);
matplotlib.cm.register_cmap(name=fna,cmap=my_cmap);
my_cmap = LinearSegmentedColormap(fna,cdict_tmp,256)
mpl.colormaps.register(name=fna,cmap=my_cmap)
"""

0 comments on commit 408f0da

Please sign in to comment.