Move legend on mobile


I noticed, that my plots do not look very nice on mobile devices.
The labels are blocking most of the plot, or the modebar overlaps with the labels.
On larger desktop devices, it is better to display the labels on the right side, but on smaller devices this basically reduces the size of the plot to nearly zero.

Is it possible to position the label depending on the screensize?

Thanks and kind regards

Desktop devices:

How I want it to look like on mobile:

How it looks like on mobile by default: