spatialdata-plot
spatialdata-plot copied to clipboard
render_shapes() - problem with cmap alpha
The alpha doesn't work for me, what am I missing? viridis = cm.get_cmap("viridis", 256) colors = viridis(np.linspace(0, 0.8, 256)) colors[0, :] = [1, 1, 1, 0] new_cmap = LinearSegmentedColormap.from_list("truncated_viridis", colors)
sdata_small.pl.render_images("Visium_HD_Mouse_Small_Intestine_full_image").pl.render_shapes( f"Visium_HD_Mouse_Small_Intestine_square_016um", color=gene_name, cmap=new_cmap).pl.show( coordinate_systems="global", title=gene_name, figsize=(10, 10))
The alpha doesn't work even when I use custon cmap with low alpha all over:
I face the same mishap, and open one issue Cannot be shown in transparent colors when Plotting the gene expression data at SpatialData.
don't know why, but guess may be associate "clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255]for integers)"
Hi, it looks like that the reason is that the fix from this PR https://github.com/scverse/spatialdata-plot/pull/239 didn't make it to a release yet. I will cut a release now.
I made the release in pip, please let me know if this fixes your issue.
Thankfully @LucaMarconato , after the update, it is now possible to display transparent colors.
pip install --upgrade spatialdata-plot==0.2.2
However, i found exp maybe diiferent if chage get_cmap() follow the prompts, and prepare to open a new issue #255 .
The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ''matplotlib.colormaps[name]'' or ''matplotlib.colormaps.get_cmap(obj)'' instead.
viridis= cm.get cmap("viridis",256)
Thanks for opening the new issue, given that the reason for this issue has been solved I will be closing this one. Currently we are in the process of going through all issues with the repositories related to SpatialData so we will address your new issue:)