CSS + Formatting Ploty.js Charts as Images

I’m exporting some plotly.js graphs as images through the toImage() method in the documentation linked here Static image export in JavaScript

I’m having trouble formatting the image it makes though, as the images have a lot of white space and I’m having a hard time formatting the spacing without cutting off any labels. I left a few screenshots below. You can see in the attached images that there is a lot of white space at the top and bottom of the charts. You can also see that labels within the bar chart are the wrong text size and are cut off, as well as labels at the bottom being cut off.



I’ve tried using the margins and padding properties on the plot, and the height and width properties don’t help much either. I’ve been unable to find anything in the documentation which makes a huge difference. Has anyone else had similar issues? Anyone have any tips, ideas, or links to documentation which might help? Any assistance is super appreciated! Thanks!