I would like to save a figure in three formats at the same time. So the code I used is like this
import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(0,1)
y=x/(1+x)
fig, ax =plt.subplots()
ax.plot(x, y)
for fmt in ['jpg', 'pdf', 'svg']:
fig.savefig('test', format='pdf')
However, only a file 'test' without extension is created. How to solve this problem?