You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to set vmin vmax when plotting vector data #324
This is the second method: sdata.pl.render_shapes("cell_circles", vmin=-1, vmax=1, color="NOTCH2", method="matplotlib").pl.show(coordinate_systems= "physical", figsize=(10,4))
The resulting plot is here:
@LucaMarconato
vmin and max only works for pl.render_images, but don't work for pl.render_shapes. And, even for pl.render_images, there is no colorbar at all ! As you can see from the spatialdata xenium tutorial:
Thanks for the observation. I have changed the title to emphasize that the issue is also open for vector data (the linked issue is indeed for raster data).
Regarding the missing colorbar, I already reported the issue here: #304, so we can follow up there. The developer assigned to the issue is temporarily not available for the next 14 days because of a pressing deadline.
I'm trying to achieve the same behaviour as your opening post, where you were looking to specify min and max values to the render_shapes() colorbar when the shapes are shaded by a particular feature -- not so worried about having a color bar for raster data / render_images(). #304 seems to be a work around for this second issue. Is there a solution/workaround for the first?
@timtreis@olivermccallion
I have tested the latest spatialdata-plot (v0.2.6) vmin and vmax works only in pl.render_images, but still don't work in pl.render_shapes .
As you can see, vmin and vmax changed the min and max number on the colorbar, but the color in the figures was not changed at all ! It is expected to be more brighter when decreasing vmax, which is the case in pl.render_images.
@timtreis
Yes, this is what I mean ! I am not familiar with matplotlib norm and don't know the clip parameter. I tested my data and found this works in pl.render_images, while don't work for pl.render_shapes, could you extend norm to pl.render_shapes` ?
@wangjiawen2013 if you would like you can check #368 to see whether it fixes the issue for you. This only fixes it for the matplotlib render. Once the solution is in I will also create a fix for the datashader.
Activity
LucaMarconato commentedon Aug 16, 2024
Hi, this is related to this #303, please try using
clip=True.wangjiawen2013 commentedon Aug 17, 2024
@LucaMarconato

vmin and max only works for
pl.render_images, but don't work forpl.render_shapes. And, even forpl.render_images, there is no colorbar at all ! As you can see from the spatialdata xenium tutorial:Here is my dataset, there is still no colorbar !
[-]vmin vmax colorbar[/-][+]Unable to set vmin vmax when plotting vector data[/+]LucaMarconato commentedon Aug 19, 2024
Thanks for the observation. I have changed the title to emphasize that the issue is also open for vector data (the linked issue is indeed for raster data).
Regarding the missing colorbar, I already reported the issue here: #304, so we can follow up there. The developer assigned to the issue is temporarily not available for the next 14 days because of a pressing deadline.
olivermccallion commentedon Sep 1, 2024
Running into the same problem with spatialdata-plot version 0.2.6.dev3+gffd4a1f where:
and
do not alter the colorbar limits / shape shading. Is there any update on the best way to fix this?
wangjiawen2013 commentedon Sep 2, 2024
@olivermccallion
Here is a workaround, spatialdata doesn't support vmin and vmax generally:
#304
olivermccallion commentedon Sep 2, 2024
Thanks @wangjiawen2013
I'm trying to achieve the same behaviour as your opening post, where you were looking to specify min and max values to the render_shapes() colorbar when the shapes are shaded by a particular feature -- not so worried about having a color bar for raster data / render_images(). #304 seems to be a work around for this second issue. Is there a solution/workaround for the first?
wangjiawen2013 commentedon Sep 3, 2024
Unfortunately not. #304 (comment)
wangjiawen2013 commentedon Sep 9, 2024
@timtreis @olivermccallion
I have tested the latest spatialdata-plot (v0.2.6)
vminandvmaxworks only inpl.render_images, but still don't work inpl.render_shapes.As you can see, vmin and vmax changed the min and max number on the colorbar, but the color in the figures was not changed at all ! It is expected to be more brighter when decreasing vmax, which is the case in
pl.render_images.5 remaining items
timtreis commentedon Sep 10, 2024
Hey @wangjiawen2013,
if I understand correctly, this is your usecase?
Or did I misunderstand something?
timtreis commentedon Sep 10, 2024
The current

normbased approach allows you to make use of the othermpl.colorsNormalisation methods, like f.e. this:wangjiawen2013 commentedon Sep 11, 2024
@timtreis
Yes, this is what I mean ! I am not familiar with matplotlib
normand don't know theclipparameter. I tested my data and found this works inpl.render_images, while don't work forpl.render_shapes, could you extendnormto pl.render_shapes` ?timtreis commentedon Sep 12, 2024
Oh weird, I'd think it should also work for
render_shapes. I'll investigate and ping youmelonora commentedon Oct 3, 2024
Picking this up today as my first PR getting back to development hehe. Will report back
melonora commentedon Oct 3, 2024
I take it that we should perhaps also add a notebook explaining the matplotlib norm.
LucaMarconato commentedon Oct 3, 2024
Agree. We can add this to the static plot workshop notebook and maybe a few extra notebooks in the
spatialdatarepo.melonora commentedon Oct 3, 2024
ok fixed it, just testing now, but here already with vmin / vmax / clip and without:

melonora commentedon Oct 4, 2024
@wangjiawen2013 if you would like you can check #368 to see whether it fixes the issue for you. This only fixes it for the matplotlib render. Once the solution is in I will also create a fix for the datashader.
wangjiawen2013 commentedon Oct 17, 2024
@melonora
Hi,
I am trying to test it. Is this fixes released in current spatialplot version ?
melonora commentedon Oct 21, 2024
Hi! This is not in the current release yet I believe. Thanks for your willingness to test! If you want you can test from main.
timtreis commentedon Oct 21, 2024
Hey @wangjiawen2013, it's not yet released but we'll have one this week that also includes a bunch of datashader fixes :)