在Python中保存绘图和EDX群集图像

在Python中保存绘图和EDX群集图像,python,arrays,image,plot,save,Python,Arrays,Image,Plot,Save,我已经导入了以下库 “”“将numpy作为np导入” 将matplotlib.pyplot作为plt导入 %matplotlib内联 从scipy.stats导入多变量_normal 将hyperspy.api作为hs导入 导入操作系统 导入seaborn作为sns“” def cluster_EDXS(文件名、n_群集、峰值、元素、binning=None、cut_off=None、normalization=False): 我想保存cluster_EDXS图像和绘图,我正在使用plt.sav

我已经导入了以下库

“”“将numpy作为np导入” 将matplotlib.pyplot作为plt导入 %matplotlib内联 从scipy.stats导入多变量_normal 将hyperspy.api作为hs导入 导入操作系统 导入seaborn作为sns“”

def cluster_EDXS(文件名、n_群集、峰值、元素、binning=None、cut_off=None、normalization=False):

我想保存cluster_EDXS图像和绘图,我正在使用plt.savefig(“”),但它不起作用

data = data_to_array(filename, binning=binning, cut_off=cut_off)

if normalization:
    data = normalize(data)

data_elements = extract_elements(data, peaks)

pi, mu, sigma = cluster_and_visualize(data_elements, n_clusters, elements)

return pi, mu, sigma