python3实现绘制二维点图
Python  /  管理员 发布于 8年前   235
如下所示:
import matplotlib.pyplot as pltplt.plot([1,2,3],[4,5,6],'ro')plt.show()#这个智障的编辑器,,,看来高版本的确修复了一些bug
用python3的qt5出来的图形,效果很好:
而且在上面的图像中也可以用调整按钮进行适当的调整。
下面我们直接用代码进行坐标的调整:
import matplotlib.pyplot as plt plt.xlim(xmax=7,xmin=0)plt.ylim(ymax=7,ymin=0)plt.plot([1,2,3],[4,5,6],'ro')plt.show()
下面加一个标题,叫做散点图
import matplotlib.pyplot as pltplt.title("I'm a scatter diagram.") plt.xlim(xmax=7,xmin=0)plt.ylim(ymax=7,ymin=0)plt.plot([1,2,3],[4,5,6],'ro')plt.show()给xy轴进行命名
import matplotlib.pyplot as pltplt.title("I'm a scatter diagram.") plt.xlim(xmax=7,xmin=0)plt.ylim(ymax=7,ymin=0)plt.xlabel("x")plt.ylabel("y")plt.plot([1,2,3],[4,5,6],'ro')plt.show()加一个标注:
import matplotlib.pyplot as pltplt.title("I'm a scatter diagram.") plt.xlim(xmax=7,xmin=0)plt.ylim(ymax=7,ymin=0)plt.annotate("(3,6)", xy = (3, 6), xytext = (4, 5), arrowprops = dict(facecolor = 'black', shrink = 0.1))plt.xlabel("x")plt.ylabel("y")plt.plot([1,2,3],[4,5,6],'ro')plt.show()多画几个图:
import matplotlib.pyplot as pltplt.subplot(221)plt.xlim(xmax=7,xmin=0)plt.ylim(ymax=7,ymin=0)plt.xlabel("x")plt.ylabel("y")plt.plot([1,2,3],[4,5,6],'ro')plt.subplot(222)plt.xlim(xmax=7,xmin=0)plt.ylim(ymax=7,ymin=0)plt.xlabel("x")plt.ylabel("y")plt.plot([1,2,3],[4,5,6],'ro')plt.subplot(223)plt.xlim(xmax=7,xmin=0)plt.ylim(ymax=7,ymin=0)plt.xlabel("x")plt.ylabel("y")plt.plot([1,2,3],[4,5,6],'ro')plt.show()以上这篇python3实现绘制二维点图就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
test1 在
opencode + Oh-my-openagent,我的第一个免费的ai编程智能体管家:Sisyphus中评论 test..122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..Zita 在
Google AI Studio升级全栈 vibe coding体验,可直接构建带登录和数据库的应用中评论 111222..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号
