Skip to content

Commit

Permalink
* plot_clustering_fill Z object type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
imtambovtcev committed Jul 15, 2024
1 parent 80a3a19 commit 27dd8a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hari_plotter/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,16 @@ def plot(self, ax: plt.Axes, group_number: int, axis_limits: dict):
# Create a ListedColormap with your colors
cmap = ListedColormap(colors)

# Custom function to check if a value is None or NaN
def is_nan_or_none(value):
return value is None or (isinstance(value, float) and np.isnan(value))

# Replace None with np.nan
Z = np.where(Z == None, np.nan, Z)

# Convert the array to float
Z = Z.astype(float)

# Use the custom colormap in imshow, with NoNorm to avoid normalization of Z values
im = ax.imshow(Z, extent=[x_lim[0], x_lim[1], y_lim[0], y_lim[1]],
origin='lower', aspect='auto', alpha=self.alpha, interpolation='nearest',
Expand Down

0 comments on commit 27dd8a0

Please sign in to comment.