Set cliponaxis: false by default for bar traces with text and textposition: 'auto' or 'outside'
#7558
+79
−6
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.
Description
Mitigation for #2001 / #2000
Normally the
cliponaxistrace parameter istrueby default, meaning that text outside the plotted area is clipped.However, since text is not taken into account when dtermining the axis range, this means that bar text placed outside the bar is almost always clipped by default, which is ugly.
This PR modifies the behavior of the
cliponaxisparameter such that it is set tofalseby default in the following scenario:text, ANDtextpositionis set to'auto'or'outside'This results in text outside bars no longer being clipped at the default axis range.
Screenshots
Before
After
Caveats
Does not change behavior whenUpdated: Now applies to bothtextpositionis set to'auto'(the default). Auto textposition typically places text inside the bar, but may place it outside occasionally if there is not enough space inside. So there is a (relatively rare) edge case where text could still be clipped.'auto'and'outside''bar'. We may want to extend this behavior to other trace types in the future if there is demand, but I figured a more targeted change makes more sense to start with.cliponaxis: true. (I wonder if perhaps we should keep the defaultcliponaxis: truewhen there are negative bars; however this risks getting into a really twisty maze of edge cases where we have to consider not only the bar values, but also the axis direction as well as which side of the plot the ticks are drawn on).