Here is a plot with a 20px margin on all sides.
Here it is with left and bottom margins of 50px.
And finally, here it is with a 50px margin on all sides.
You can see that the margins on being applied correctly on the top and right, but not on the left and bottom, where the axes are.
For context, I used Plotly 6.0.0 with Python 3.9.19 to generate these plots, but I'm able to reproduce this issue with Python 3.12.9 as well, so I suspect I must be using something wrong.