-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Provide room for large computed margins #5237
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
404fe7a
fix issue 4459 - provide more room to bring back large computed margins
archmoj 09e2339
add image test
archmoj 921e5a5
add a test for the case of large horizontal margin
archmoj 28fc880
add a minimum pixel for margins - add test with margins on both sides
archmoj 670d238
reduce large margins on both sides by a ratio instead of setting them…
archmoj 565f942
adjust large margins instead of dropping them
archmoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would mean your automargin can expand so much the plot itself completely disappears. That doesn't seem like a good idea. I'm also concerned about what would happen if you have large margin pushers on opposite sides - tick labels on the left and legend on the right, for example. I suspect that with the 0.5 that was here before you could in principle get right up to the edge of no visible plot but not quite pass it.
Perhaps rather than discarding the constraint, a better solution would be to just limit the end result?
o.l
,o.r
etc) to no more than half the total size, which I think should ensure there IS a solution to the loop trying to satisfy all these constraintslayout.margin
value - in that case take more from the other side.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcjohnson Thanks for the review and pointers.
I added an image test in 09e2339.
Noting that in this example we wanted the lower margin to be greater than half of the size, I still think that to fix this bug we should relax the constraint there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m OK with allowing one margin to be bigger than half the plot, as long as (a) there are no situations where we fail entirely (large margins on both sides from different elements - this will need a test or two) and (b) the plot never becomes too small to be useful (I suggest minimum 1/4 the total size but we could go a little further if you think it important)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While testing this with margins on both sides I didn't encounter a major change between before and after behaviour in respect to this change.
In fact the change here basically allows one margin to be bigger than half of the plot not both which is the reported bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that idea -
layout.margin.minfinal(width|height)
perhaps, with a default of something like 100 (px).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Addressed in 28fc880.
And we could expose those constants (also with a relative option) in a separate PR.