To save a matplotlib figure in SVG format by default, you can configure the rcParams (runtime configuration parameters) at the start of your script. This way, every figure you create will be saved in SVG unless you explicitly specify otherwise.
Method 1: Set SVG as the Default Save Format
Add this line at the beginning of your script:
import matplotlib.pyplot as plt
plt.rcParams['savefig.format'] = 'svg'
Now, whenever you call plt.savefig("filename"), the figure will be saved in SVG format by default.
Method 2: Specify SVG Format Explicitly (Alternative)
If you want to ensure SVG format is used for a specific save, you can also do:
plt.savefig("filename.svg", format="svg")
Which method do you prefer? I can also show you how to combine this with other settings, like DPI or transparent backgrounds, if needed!