1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > Python使用matplotlib实现在坐标系中画一个矩形办法

Python使用matplotlib实现在坐标系中画一个矩形办法

时间:2023-10-07 05:07:37

相关推荐

Python使用matplotlib实现在坐标系中画一个矩形办法

后端开发|Python教程

Python,matplotlib,画矩形

后端开发-Python教程

本文实例讲述了Python使用matplotlib实现在坐标系中画一个矩形的方法。分享给大家供大家参考。具体实现方法如下:

struts2 in action 源码,Ubuntu处理txt文档,爬虫箱爬架,php 感想,seo更新首页lzw

import matplotlib.pyplot as pltfrom matplotlib.patches import Rectangleclass Annotate(object): def __init__(self): self.ax = plt.gca() self.rect = Rectangle((0,0), 1, 1) self.x0 = None self.y0 = None self.x1 = None self.y1 = None self.ax.add_patch(self.rect) self.ax.figure.canvas.mpl_connect(utton_press_event, self.on_press) self.ax.figure.canvas.mpl_connect(utton_release_event, self.on_release) def on_press(self, event): print press self.x0 = event.xdata self.y0 = event.ydata def on_release(self, event): print elease self.x1 = event.xdata self.y1 = event.ydata self.rect.set_width(self.x1 - self.x0) self.rect.set_height(self.y1 - self.y0) self.rect.set_xy((self.x0, self.y0)) self.ax.figure.canvas.draw()a = Annotate()plt.show()

下图例:

centos mysql源码版安装,ubuntu 编辑无法保存,爬虫王者荣耀皮肤,内嵌php,seolzw

源码模板可以更新,群晖vvm ubuntu,下了个tomcat怎么启动,爬虫实验截图,php什么公司,南昌百度seo联系方式lzw

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。