Plotly.js: Legend overlaps the y-axis title

Created on 13 Apr 2017  路  5Comments  路  Source: plotly/plotly.js

Hi,
Can we adjust the width/height of the legend (containing multiple legend items) to prevent it from being overlapped on y-axis title?
Here is the code which shows multiple y-axes but the legend overlaps the title of second y-axis (at the right side of the graph).

screenshot from 2017-04-13 12 07 32

Any help will be appreciated.
Thanks!

Most helpful comment

Shouldn't plotly be aware of the second y-Axis and move the legend accordingly automatically?

All 5 comments

Can we adjust the width/height of the legend

Short answer: no.

Longer answer: I'm not sure how width/height would help you in this case. What you really need is to input a valid legend.x value like in http://codepen.io/etpinard/pen/WjbNRZ?editors=0010

Alternatively, you can try increasing the right margin (e.g. with `layout.margin.r: 100) and/or make the trace name smaller.

Closing due to lack of activity after my https://github.com/plotly/plotly.js/issues/1594#issuecomment-293936664

Thanks! It worked. Actually I was thinking to adjust its width and height such that the scrollbar could appear, but your solution worked better.

Shouldn't plotly be aware of the second y-Axis and move the legend accordingly automatically?

legend below + x axis analogue: https://github.com/plotly/plotly.js/issues/1199

Was this page helpful?
0 / 5 - 0 ratings