Skip to content

Commit 567831d

Browse files
authored
Fix colormap handling of a constant color in _plottools.py
1 parent 0f3a841 commit 567831d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/openpnm/visualization/_plottools.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import matplotlib.pyplot as plt
44
import numpy as np
55
from matplotlib.pyplot import cm
6+
from matplotlib.colors import ListedColormap
67

78
import openpnm as op
89

@@ -153,6 +154,8 @@ class of matplotlib, so check their documentation for additional
153154
cmap = plt.colormaps.get_cmap(cmap)
154155
except AttributeError:
155156
cmap = plt.cm.get_cmap(cmap)
157+
else:
158+
cmap = ListedColormap(color, name="throat_cmap")
156159
kwargs['cmap'] = cmap
157160
# Override colors with color_by if given
158161
if color_by is None:

0 commit comments

Comments
 (0)