解决“jupyter导出图片怎么是空白的”

原来代码如下:

plt.plot(x1,y1,'ro-',linewidth = 2.5,label = 'Influence curve of ore flow rate on leaching')
#标签标记位置在左下角
plt.legend(loc='upper right')
#取出图片的坐标轴
ax1 = plt.gca()
#设置图片标题,fontname设置字体,fontsize设置字号,weight设置粗体,style设置斜体
#ax1.set_title('Influence curve of ore flow rate on leaching',fontname = 'Times New Roman',fontsize = 10,weight = 'bold')
#设置x轴和y轴的标签
ax1.set_xlabel('Ore flow rate(kg/h)',fontname = 'Times New Roman',weight = 'bold')
ax1.set_ylabel('Leaching rate(%)',fontname = 'Times New Roman',weight = 'bold')
ax1.tick_params(axis='both',direction = 'in',
                color = 'blue',length = 6,width = 2)

plt.show()

plt.savefig('C:/Users/Desktop/111.png',bbox_inches = 'tight',pad_inches = 0,dpi=600)

导出之后图片如下:是空白的
解决“jupyter导出图片怎么是空白的”_第1张图片修改为:

plt.plot(x1,y1,'ro-',linewidth = 2.5)

#取出图片的坐标轴
ax1 = plt.gca()
#设置图片标题,fontname设置字体,fontsize设置字号,weight设置粗体,style设置斜体
#ax1.set_title('Influence curve of ore flow rate on leaching',fontname = 'Times New Roman',fontsize = 10,weight = 'bold')
#设置x轴和y轴的标签
ax1.set_xlabel('Ore flow rate(kg/h)',fontname = 'Times New Roman',weight = 'bold')
ax1.set_ylabel('Leaching rate(%)',fontname = 'Times New Roman',weight = 'bold')
ax1.tick_params(axis='both',direction = 'in',
                color = 'blue',length = 6,width = 2)

    
plt.savefig('11.png',dpi=600)
plt.show()

就可以在根目录里找到图片 然后download

你可能感兴趣的:(jupyter,数学建模,matlab)