Defining figure size independent of legend

Is there a way to define the figure size independent of the legend?
When I am having a graph of a defined size and I increase the length of the trace names this messes up the aspect ratio of my graph. Can I exclude the legend from the figure size?

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online