Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmaps can be linear segmented #11

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading