spatialdata-plot icon indicating copy to clipboard operation
spatialdata-plot copied to clipboard

Plotting multiple elements in the same `ax` seems to work only when `show()` is not called.

Open LucaMarconato opened this issue 1 year ago • 2 comments

I refer to the code mentioned in this other issue: https://github.com/scverse/spatialdata-plot/issues/68

This code here:

    ax = plt.gca()
    sdata.pl.render_shapes(element='s', na_color=(0.5, 0.5, 0.5, 0.5)).pl.render_points().pl.show(ax=ax)
    sdata.pl.render_shapes(element='c', na_color=(0.7, 0.7, 0.7, 0.5)).pl.show(ax=ax)
    plt.show()

doesn't work if I run the code as a script, but it works in interactive mode (where because of a bug the plots are not shown until I call plt.show()). I suggest to do like scanpy and having a parameter show: bool. I suggest also that if the parameter ax is not None, then show is set to False. I don't remember if this one is also a behavior of scanpy, but I think it's reasonable.

LucaMarconato avatar May 14 '23 13:05 LucaMarconato