What causes large automargins?

Hi guys, absolutely plotly.js beginner here. I was wondering why sometimes the margins automatically set by plotly are so large. This official example is a good illustration:

https://codepen.io/plotly/pen/EdWVVy

The left margin looks fine, but why do the other 3 sides get such large margins? I can’t figure out where that large margin size is coming from.

See https://codepen.io/etpinard/pen/QPVVjB?editors=0010

In brief, setting automargin: true won’t shrink the default margin which is of 80px to the left, right and bottom and 100px to the top. To get “fitted” margin, you have first remove the default margin with:

layout.margin: {l: 0, t: 0, b: 0, r: 0}
1 Like