Skip to content

Save image in original resolution #42

@kolibril13

Description

@kolibril13

Hi!
I want to save my plot with the ScaleBar, here is my code:

fig, ax = plt.subplots()
ax.axis("off")
ax.imshow(my_slice3, cmap="gray")
scalebar = ScaleBar(650, "nm", length_fraction=0.25, location= "lower right")
ax.add_artist(scalebar)
plt.savefig('foo.png')

When I save the image, the resolution is not anymore the resolution of the original image.
At Stack Overflow I found the hint, that one can use imsave , but that is not working with the Scalebar.
https://stackoverflow.com/questions/31544130/saving-an-imshow-like-image-while-preserving-resolution
I know that I can increase the resolution e.g. with
plt.rcParams['figure.dpi'] = 300 .
But that is not leading to the exact pixel-by-pixel image.
Any idea how to solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions