Skip to content

Commit

Permalink
cmaps can be linear segmented
Browse files Browse the repository at this point in the history
  • Loading branch information
colganwi committed Aug 24, 2024
1 parent 6c5e760 commit d00a61a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pycea/pl/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def _series_to_rgb_array(series, colors, vmin=None, vmax=None, na_color="#808080
color_series = series.map(colors).astype("object")
color_series[series.isna()] = na_color
rgb_array = np.array([mcolors.to_rgb(color) for color in color_series])
elif isinstance(colors, mcolors.ListedColormap):
elif isinstance(colors, mcolors.ListedColormap | mcolors.LinearSegmentedColormap):
# Normalize and map values if cmap is a ListedColormap
if vmin is not None and vmax is not None:
norm = mcolors.Normalize(vmin, vmax)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plot_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_angled_numeric_annotations(tdata):
)
pycea.pl.nodes(tdata, nodes="all", color="time", style="s", size=20)
pycea.pl.nodes(tdata, nodes=["2"], tree="1", color="black", style="*", size=200)
pycea.pl.annotation(tdata, keys=["x", "y"], cmap="magma", width=0.1, gap=0.05, border_width=2)
pycea.pl.annotation(tdata, keys=["x", "y"], cmap="jet", width=0.1, gap=0.05, border_width=2)
pycea.pl.annotation(tdata, keys=["0", "1", "2", "3", "4", "5"], label="genes", border_width=2)
plt.savefig(plot_path / "angled_numeric.png")
plt.close()
Expand Down

0 comments on commit d00a61a

Please sign in to comment.