电子商务网站建设与管理笔试用文本文档做网页
web/
2025/10/4 5:31:42/
文章来源:
电子商务网站建设与管理笔试,用文本文档做网页,做做网站2023下载,昆明百度关键词优化机器学习的过程中处理数据#xff0c;会遇到数据可视化的问题#xff0e; 大部分都是利用python的matplotlib库进行数据的可视化处理#xff0e; plt.show() 默认都是输出.png文件#xff0c;图片只要稍微放大一点#xff0c;就糊的不行#xff0e; 下面给出一段正常进行…机器学习的过程中处理数据会遇到数据可视化的问题 大部分都是利用python的matplotlib库进行数据的可视化处理 plt.show() 默认都是输出.png文件图片只要稍微放大一点就糊的不行 下面给出一段正常进行数据处理可视化输出图片的代码 import pandas as pd
import matplotlib.pyplot as pltwith open(sourcedata2.csv)as f:dfpd.read_csv(f,header0)Xdf[df.columns[1:6]]
ydf[Vibration]
plt.figure()
f,ax1plt.subplots()
for i in range(1,7):number320iax1.locator_params(nbins3)ax1plt.subplot(number)plt.title(list(df)[i])ax1.scatter(df[df.columns[i]],y)
plt.tight_layout(pad0.4,w_pad0.5,h_pad1.0)
plt.show() 上面这段代码会直接显示出绘制的图像我们可以将图片另存为 但是我们是不是可以直接在代码中将图片进行保存呐 matplotlib,pyplot中有一个内置函数savefig 查看savefig()函数的功能 savefig(*args, **kwargs)Save the current figure.Call signature::savefig(fname, dpiNone, facecolorw, edgecolorw,orientationportrait, papertypeNone, formatNone,transparentFalse, bbox_inchesNone, pad_inches0.1,frameonNone)The output formats available depend on the backend being used.Arguments:*fname*:A string containing a path to a filename, or a Pythonfile-like object, or possibly some backend-dependent objectsuch as :class:~matplotlib.backends.backend_pdf.PdfPages.If *format* is *None* and *fname* is a string, the outputformat is deduced from the extension of the filename. Ifthe filename has no extension, the value of the rc parametersavefig.format is used.If *fname* is not a string, remember to specify *format* toensure that the correct backend is used.Keyword arguments:*dpi*: [ *None* | scalar 0 | figure]The resolution in dots per inch. If *None* it will default tothe value savefig.dpi in the matplotlibrc file. If figureit will set the dpi to be the value of the figure.*facecolor*, *edgecolor*:the colors of the figure rectangle*orientation*: [ landscape | portrait ]not supported on all backends; currently only on postscript output*papertype*:One of letter, legal, executive, ledger, a0 througha10, b0 through b10. Only supported for postscriptoutput.*format*:One of the file extensions supported by the activebackend. Most backends support png, pdf, ps, eps and svg.可以看到一个关键词参数format,it support png,pdf,ps,eps and svg. 重新实现上一段代码 Xdf[df.columns[1:6]]
ydf[Vibration]
plt.figure()
f,ax1plt.subplots()
for i in range(1,7):number320iax1.locator_params(nbins3)ax1plt.subplot(number)plt.title(list(df)[i])ax1.scatter(df[df.columns[i]],y)
plt.tight_layout(pad0.4,w_pad0.5,h_pad1.0)
plt.savefig(fnamename,formatsvg)
plt.show() 在plt.savefig()函数的format参数选择你需要保存图片的格式,和图片的名称fnameyour picture name 就可以实现图片多种格式的输出 利用graphviz来绘制绘图神经网络的图(也就是其基本的模型架构)可以使用process on 也可以在python库函数中进行绘制 from pydotplus import graphviz 转载于:https://www.cnblogs.com/GeekDanny/p/9300201.html
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/86614.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!