Skip to content

Commit

Permalink
converting color_by data to float so math works on it
Browse files Browse the repository at this point in the history
  • Loading branch information
jgostick committed Aug 29, 2023
1 parent e50ee4a commit cf4480f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openpnm/visualization/_plottools.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class of matplotlib, so check their documentation for additional
cmap = plt.colormaps[cmap]
# Override colors with color_by if given
if color_by is not None:
color_by = np.array(color_by, dtype=np.float16)
if len(color_by) != len(Ts):
color_by = color_by[Ts]
if not np.all(np.isfinite(color_by)):
Expand Down Expand Up @@ -342,6 +343,7 @@ def plot_coordinates(network,
if isinstance(cmap, str):
cmap = plt.colormaps[cmap]
if color_by is not None:
color_by = np.array(color_by, dtype=np.float16)
if len(color_by) != len(Ps):
color_by = color_by[Ps]
if not np.all(np.isfinite(color_by)):
Expand Down

0 comments on commit cf4480f

Please sign in to comment.