Suppose you have multiple figures and you want to save them independently when you want in the code: make sure you can access it by a unique name:
fig100 = figure()
outputBoxplot100 = df_100.boxplot(column=['1', '2', '4', '5', '8'])
plt.title("100 MHz")
fig150 = figure()
outputBoxplot150 = df_150.boxplot(column=['1', '2', '4', '5', '8'])
plt.title("150 MHz")
# do other stuff
fig100.savefig("test100.svg", format="svg")
fig150.savefig("test150.svg", format="svg")
In this case, I would change your code in:
import matplotlib.pyplot as plt
from pandas import DataFrame
import numpy as np
df = DataFrame(np.random.rand(10,5))
myFig = plt.figure();
bp = df.boxplot()
myFig.savefig("myName.svg", format="svg")
The result will be a saved file named "myName.svg":
Please note: I am using svg
but you can use the format you like the most ( png
, jpeg
, etc) that this micro supports. Check on the availability on Pandas website.