Is there some way to tell Plotly.js to automatically determine the margins for a plot? If I don’t set any margins myself, the axis labels and tick labels can get cut off. And setting explicit margins is difficult, especially for dynamically created charts, because the size of the title, axis labels, and tick marks is variable.
Am I missing some way to let Plotly determine the appropriate margins that allow the plot and its labels to fit in the available space?
Short answer: no.
We’ve been trying to solve this problem for a while now, but we haven’t found a perfect solution yet.
I’d recommend subscribing to https://github.com/plotly/plotly.js/issues/296 for the latest development info.
OK, thanks. What about margins for the chart tile and axis titles? For example, my chart title gets overlaid by the tool icons, so I’d like to move it down a bit. And date axis labels that wrap are getting overlaid by the axis title. Changing the chart layout margin seems to increase the distance from the container edges to the plot itself, but the chart title isn’t affected, and the axis titles seem to move with the plot so their distance from the tick labels doesn’t change.