-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Adding automargin support to plot titles #6428
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
Conversation
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
<
10000
div class="js-socket-channel js-updatable-content" data-channel="eyJjIjoicmVwbzo0NTY0NjAzNzpjb21taXQ6NGJiMTA5ZTc0OWVjMTg2ZjJjNzY2ZDY3YmFmNTc1N2NlNjY3YjE0MCIsInQiOjE3NDk5MjE0MjB9--d0bd9b4281cbef5e3b069a9f0f8b4fcde46aded44ae2d031494c3f0837e4ca9c" data-url="/plotly/plotly.js/pull/6428/partials/commit_status_icon?oid=4bb109e749ec186f2c766d67baf5757ce667b140">
archmoj
reviewed
Feb 22, 2023
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.
@hannahker very nice improvement.
Please find my comments below.
Thank you!
archmoj
reviewed
Mar 13, 2023
archmoj
reviewed
Mar 13, 2023
archmoj
reviewed
Mar 13, 2023
archmoj
reviewed
Mar 13, 2023
archmoj
reviewed
Mar 13, 2023
archmoj
reviewed
Mar 13, 2023
archmoj
reviewed
Mar 13, 2023
archmoj
reviewed
Mar 14, 2023
alexcjohnson
approved these changes
Mar 15, 2023
This is so good for multiline titles, thank you very much! |
kMutagene
added a commit
to plotly/Plotly.NET
that referenced
this pull request
Jul 9, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request adds 'automargin' support for
layout.title
components. Iflayout.title.automargin=true
, then either the top or the bottom margin space will expand such that the plot title is visible in the plotting area.To-dos:
title.automargin
layout.title.y
title.y=1
andtitle.yref='paper'
defaults whentitle.automargin=true
(insupplyDefaults
stage)yanchor
yref='paper'
yref='paper'
yref='container'
yref='container'
title.yanchor
#6472yref='paper'
API Questions:
Should
title.automargin
support multi-line titles? Looking at this codepen, there seem to be some issues with multi-line positioning, see Multi-line titles don't respond totitle.yanchor
#6472A: Currently out of scope given existing bug.
Should
title.automargin
allow the title to overlap with the plot itself? Or doestitle.automargin
only ensure that the title is visible? Ex. what iftitle.y=0.6
? Should the margin then expand to take up the top 40% of the plot area?A: This depends on
title.yref
. When the title is'paper'
referenced, thentitle.automargin
can't do anything to impact potential overlap with the plot area, as the plot area is also'paper'
referenced. When the title is'container'
referenced, thentitle.automargin
will increase the top or bottom margin to avoid overlap with the plot area.If a developer manually specifies
title.yref='container'
andtitle.automargin
, then which one 'wins'?A: N/A. In this case
title.automargin
will have an impact.layout.title.y=1
+layout.title.yanchor='bottom'
/layout.title.y=0
+layout.title.yanchor='top
--> shouldautomargin
handle these cases so that the title is visible? Logically, I don't think it should be.A: Assuming that
title.yref='container'
, the title should not be visible in these cases as it is outside of the plot area. Iftitle.yref='paper'
, then this would be a common way to pin the title to either the top or bottom of the plot area.What if
layout.title.y='auto'
and there isn't enough manually-defined top margin to fit the title? (ref: ""auto" places the baseline of the title onto the vertical center of the top margin"). Should we add in logic here so that the top margin will expand to 2x the size of the title? It doesn't seem intuitive to the developer in this case that the top margin will have this artificial padding.A: When
title.automargin=true
, we can set the defaulttitle.y=1
, which is a more logical default and would avoid this behaviour.How will
title.automa 10000 rgin
behaviour be different whenyref='container'
vsyref='paper'
?A: If
yref='container'
, thentitle.automargin
will push margins to ensure that the title doesn't overlap with the plot area. Ifyref='paper'
, thentitle.automargin
will only push margins to ensure that the title doesn't overlap with the edges of the container.Should
title.automargin
potentially push out the left or right margins?A: No, this implementation will only support spacing added to top or bottom margins.
Technical Questions:
x
andy
input parameters to thePlots.autoMargin
function be specified? I would expect that these would be justtitle.x
andtitle.y
. In testing, seems only to work wheny
is1
or0
. (ref: "x, y: plot fraction of the anchor point.")title.automargin
applies bottom margin as well as the x-axis?