I have some simple plots in an Rmarkdown file plotted with matplotlib in a python chunk using the R-Reticulate package. But for some reason, the graphs always get squished no matter how I specify the figsize in python. It seems as if it is a problem with RMarkdown because I have plotted the same graphs in a .py file and they come out fine. Does anyone know how to prevent this resizing from RMarkdown?
Here is the code:
```{python, message=FALSE, results='hide', fig.keep='all'}
fig = plt.figure(figsize=(10,8))
plt.xlabel('Log Dispersion (km/s)', fontsize='x-large', fontweight='bold')
plt.ylabel(r'Log Black Hole Mass ($M_\odot$)', fontsize='x-large', fontweight='bold')
plt.scatter(data.SIG, data.MBH, label='data')
plt.show()
```
Here is the output in RMarkdown:
As you can see, it gets cutoff. Meanwhile, this same code in a .py file is totally fine. I have tried changing the figure size in fig = plt.figure(figsize=(10,8)) and it does absolutely nothing.