Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic aspect ratio calculation #733

Merged
merged 6 commits into from
Sep 3, 2024

Conversation

eugenioLR
Copy link
Contributor

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
Copy link
Contributor Author

eugenioLR commented Jul 12, 2024

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 SarthakJariwala self-requested a review July 23, 2024 20:47
Copy link
Owner

@SarthakJariwala SarthakJariwala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. Left a few small comments

src/seaborn_image/_grid.py Outdated Show resolved Hide resolved
src/seaborn_image/_grid.py Outdated Show resolved Hide resolved
src/seaborn_image/_grid.py Outdated Show resolved Hide resolved
@SarthakJariwala
Copy link
Owner

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

@SarthakJariwala SarthakJariwala added enhancement New feature or request python Pull requests that update Python code labels Aug 16, 2024
@eugenioLR
Copy link
Contributor Author

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

Copy link
Owner

@SarthakJariwala SarthakJariwala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for making the changes.

@SarthakJariwala SarthakJariwala merged commit a3fe0ef into SarthakJariwala:master Sep 3, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants