Legend getting cut off when put inside iframe on website with tabs

So I have a website in HTML that I didn’t make but am editing it to add plot_ly plots. I don’t know much about HTML or CSS however am learning more.

The website has tabs, I added plot_ly plots as iframes to the front tab and they work perfectly (I’m just showing the legends):

However when I add a plot_ly plot to a tab that’s not the front page, the legend cuts off (and also the x axis but it doesn’t do it as much). The code is the same to make the plot_ly legends and the HTML is the same:

Broken plot

I’ve looked at these two topics:

I haven’t been able to find a solution, would appreciate some help. Also if i reload the frame they work, but I don’t want to be doing that.