✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Can Plotly offset the legend from the axis automatically?

I am working with plotly for javascript.
I am receiving data from forms in order to determine where the legend will be displayed.
But I discovered that the y axis titles and the legend overlap themselves.
Here’s my example :

Is there any possibilities to automatically offset the legend in order to avoid any overlap with the axis and their labels?
Like if there is a right axis with the title, legend.x’s offset is 1.05 (which seems to do the trick in this case) instead of 1.
Thank you!