SarthakJariwala / seaborn-image

High-level API for attractive and descriptive image visualization in Python
https://seaborn-image.readthedocs.io/
MIT License
66 stars 7 forks source link

Automatic aspect ratio calculation #733

Closed eugenioLR closed 1 month ago

eugenioLR commented 3 months ago

As I commented on issue #732, I had an idea to calculate the aspect ratio of the figure when using ImageGrid so that there isn't so much white space between subplots when displaying images with uneven aspect ratios.

I implemented it by setting the parameter aspect to 'auto', which triggers a couple of lines of code to calculate it from the dimensions of the image. Since lists of images are also supported, I also made it so it uses the lowest aspect ratio among the images, since it would make them overlap in the figure otherwise.

eugenioLR commented 3 months ago

It doesn't seem to work on macOS, but it looks like it's not an issue of the pull request since this same thing is happening on the other pull requests.

SarthakJariwala commented 2 months ago

Another thing I would recommend adding are tests for the aspect ratio

eugenioLR commented 1 month ago

I saw all the comments and they all seem reasonable. I addressed all the issues you raised, Everything should be correct now.