Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
要将python输出保存到我的本地文件夹吗_Python_Image_Tensorflow_Matplotlib_Data Science - Fatal编程技术网

要将python输出保存到我的本地文件夹吗

要将python输出保存到我的本地文件夹吗,python,image,tensorflow,matplotlib,data-science,Python,Image,Tensorflow,Matplotlib,Data Science,要将python matplotlib输出保存到计算机中的本地文件夹中吗 我的代码 fig = plot.figure(figsize=(30, 30)) outer = gridspec.GridSpec(5, 5, wspace=0.2, hspace=0.2) for i in range(5): inner = gridspec.GridSpecFromSubplotSpec(2, 1,subplot_spec=outer[i], wspace=0.1, hspace=0.1)

要将python matplotlib输出保存到计算机中的本地文件夹中吗

我的代码

fig = plot.figure(figsize=(30, 30))
outer = gridspec.GridSpec(5, 5, wspace=0.2, hspace=0.2)

for i in range(5):
    inner = gridspec.GridSpecFromSubplotSpec(2, 1,subplot_spec=outer[i], wspace=0.1, hspace=0.1)
   #rnd_number = randint(0,len(pred_images))  # for random output
    rnd_number = i
    pred_image = np.array([pred_images[rnd_number]])
    #pred_image = np.array(pred_images)
    pred_class = get_classlabel(loaded_model.predict_classes(pred_image)[0])
    pred_prob = loaded_model.predict(pred_image).reshape(6)
    for j in range(2):
        if (j%2) == 0:
            ax = plot.Subplot(fig, inner[j])
            ax.imshow(pred_image[0])
            ax.set_title(pred_class)
            ax.set_xticks([])
            ax.set_yticks([])
            fig.add_subplot(ax)
        else:
            ax = plot.Subplot(fig, inner[j])
            ax.bar([0,1,2,3,4,5],pred_prob)
            fig.add_subplot(ax)

plot.figure(figsize=(15,15))
#fig.show()
在执行上述代码之后

现在,我想输出保存在计算机上的特定文件夹

1个图像及其图形,即在1个jpg文件中 2图像及其图形,即在2 jpg文件中


同样,我希望它对所有图像都适用。

同样的问题有时已经得到了回答。
请您检查
仍然以非常笼统的方式,您可以像下面这样继续操作。
在您的情况下,我假设您将matplotlib库导入为“绘图”


我已经看过了你们提到的帖子,但我的问题是有点不同,比如-----1个图片和它的图形,比如在1个jpg文件中--2个图片和它的图形,比如在2个jpg文件中,我希望它对所有图片都这样做
fig = plot.figure(figsize=(30, 30))
....Your Code...
fig.savefig('path/to/save/image/to.png')