Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Label is truncated in y-axis plotly

Tags:

plotly

I have created a boxplot with boxply, everything looks good except the labels in y-axis are truncated. That's really frustrating because it's crucial information. When you go to codepen.io/plotly/pen/gMPopL and modify the name of trace2 you will see what's happing. I can't find how to modify the width of y-axis value in the documentation.

like image 677
Joost Avatar asked Mar 07 '26 11:03

Joost


1 Answers

You can give more room for your axis labels by adjusting the margin.

in your layout variable add a new key "margin" of the form:

var layout = {
  title: 'Horizontal Box Plot',
  margin: {
    l: 200,
    r: 100,
    t: 50,
    b: 10
  }
};

l = left margin, r = right, t = top, b = bottom. the values are in pixels. You can include or exclude keys as you need. In your case you likely want

margin: { l:100 }

where you can play with the number 100 to make the left margin as big as you need it.

like image 90
JimInCanada Avatar answered Mar 09 '26 19:03

JimInCanada