spatialdata-plot
spatialdata-plot copied to clipboard
Different plot if specifying `dpi=` in `plt.figure()` vs in `pl.show()`
I have noticed that if I create a figure with plt.figure(), setting the dpi in plt.figure() leads to a smaller plot than if setting the dpi in pl.show().
I think, but to be double-checked, that the correct version is the one given by pl.show().
Code to reproduce:
import spatialdata_plot
from spatialdata.datasets import blobs
import matplotlib.pyplot as plt
sdata = blobs()
# ok
plt.figure(figsize=(10, 10), dpi=72)
sdata.pl.render_points('blobs_points').pl.show()
plt.savefig('dpi_72.png')
plt.show()
# plot is larger
plt.figure(figsize=(10, 10), dpi=300)
ax = plt.gca()
sdata.pl.render_points('blobs_points').pl.show(ax=ax)
plt.savefig('dpi_300_method_1.png')
plt.show()
# plot is larger
plt.figure(figsize=(10, 10))
ax = plt.gca()
sdata.pl.render_points('blobs_points').pl.show(ax=ax, dpi=300)
plt.savefig('dpi_300_method_2.png')
plt.show()
Q(@Sonja-Stockhaus) from call:
do we do anything with DPI if we're not generating the ax?