plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

[BUG] Text is cut off on bars where textposition=outside

Open RedShift1 opened this issue 9 years ago • 8 comments

When drawing a bar plot with { textposition: outside }

the text of the highest values is sometimes cut off:

plotly_bars_text

JSFiddle: https://jsfiddle.net/vuqugx8v/

RedShift1 avatar Sep 13 '17 14:09 RedShift1

Yes, this is the same issue as #2000 - closing this one, we will make sure the fix handles both scatter and bar traces.

alexcjohnson avatar Sep 13 '17 14:09 alexcjohnson

Has the bug been Fixed or not yet? I recently use Dash to plot bar chart, the cut off problem still exists.

babykick avatar Dec 05 '17 04:12 babykick

In case some one stumbles across this, use the cliponaxis: false option (from the above referenced PR)

Example - CodePen

dfaivre avatar Aug 06 '19 17:08 dfaivre

I just ran into a case where setting cliponaxis: false just wouldn't work. One workaround is to explicitly set the yaxis range to [0,7000] but I think more direct is to set the top margin to 20px or something large enough to show the label

Set top margin to 20px image

Set yaxis range a little wider: image

protobi-pieter avatar Nov 12 '21 03:11 protobi-pieter

for a bar chart the only thing that works for me is calculating the max value and multiplying the max by 1.1 to extend the range. Hope this gets fixed.

brandonerose avatar Nov 29 '21 17:11 brandonerose

I found a useful workaround! If you add the label as an annotation instead of texposition outside it will not get cut off :)

brandonerose avatar Nov 29 '21 18:11 brandonerose

special case of https://github.com/plotly/plotly.js/issues/2000

emilykl avatar Sep 15 '25 20:09 emilykl

Reopening this one as it best captures the specific issue addressed by #7675

emilykl avatar Dec 17 '25 19:12 emilykl