PyQtGraph Basic Realization[2]
2018-12-25 08:24:47来源:博客园 阅读 ()
Profile
Last Time We managed to add logic wave in the GraphicsLayoutWidget. Today We Try to add Curve for the GraphicsLayoutWidgets.
First Step
We Need to set the PlotItem clickable as well
plt1.plot(list1,pen=pg.mkPen(color='#AA0000', width=1),name="Red Line")
curvePlot.curve.setClickable(True)
Second Step
Add LineRegionItem to the first plot
lr = pg.LinearRegionItem([1, 30], bounds=[0, 100], movable=True) plt1.addItem(lr)
About The LinearRegionItem
__init__(values=(0, 1), orientation='vertical', brush=None, pen=None, hoverBrush=None, hoverPen=None, movable=True, bounds=None, span=(0, 1), swapMode='sort')
values | A list of the positions of the lines in the region. These are not limits; limits can be set by specifying bounds. |
orientation | Options are ‘vertical’ or ‘horizontal’, indicating the The default is ‘vertical’, indicating that the |
brush | Defines the brush that fills the region. Can be any arguments that are valid for mkBrush . Default is transparent blue. |
pen | The pen to use when drawing the lines that bound the region. |
hoverBrush | The brush to use when the mouse is hovering over the region. |
hoverPen | The pen to use when the mouse is hovering over the region. |
movable | If True, the region and individual lines are movable by the user; if False, they are static. |
bounds | Optional [min, max] bounding values for the region |
span | Optional [min, max] giving the range over the view to draw the region. For example, with a vertical line, use span=(0.5, 1) to draw only on the top half of the view. |
swapMode |
Sets the behavior of the region when the lines are moved such that their order reverses: * “block” means the user cannot drag one line past the other * “push” causes both lines to be moved if one would cross the other * “sort” means that lines may trade places, but the output of
The default is “sort”. |
Third Step
Add single Line
line = pg.InfiniteLine(angle=90, movable=True) plt1.addItem(line) line.setBounds([0, 200])
About The InfiniteLine
__init__(pos=None, angle=90, pen=None, movable=False, bounds=None, hoverPen=None, label=None, labelOpts=None, span=(0, 1), markers=None, name=None)
Arguments: | |
pos | Position of the line. This can be a QPointF or a single value for vertical/horizontal lines. |
angle | Angle of line in degrees. 0 is horizontal, 90 is vertical. |
pen | Pen to use when drawing line. Can be any arguments that are valid for mkPen . Default pen is transparent yellow. |
hoverPen | Pen to use when the mouse cursor hovers over the line. Only used when movable=True. |
movable | If True, the line can be dragged to a new position by the user. |
bounds | Optional [min, max] bounding values. Bounds are only valid if the line is vertical or horizontal. |
hoverPen | Pen to use when drawing line when hovering over it. Can be any arguments that are valid for mkPen . Default pen is red. |
label | Text to be displayed in a label attached to the line, or None to show no label (default is None). May optionally include formatting strings to display the line value. |
labelOpts | A dict of keyword arguments to use when constructing the text label. See InfLineLabel . |
span | Optional tuple (min, max) giving the range over the view to draw the line. For example, with a vertical line, use span=(0.5, 1) to draw only on the top half of the view. |
markers | List of (marker, position, size) tuples, one per marker to display on the line. See the addMarker method. |
name | Name of the item |
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- PyQtGraph Basic Realization 2018-12-24
- 日志 2018-11-13
- Visual Basic 2012 借助DataGridView控件将Excel 2010数据导 2018-06-17
- Visual Basic 2012 借助DataGridView控件将SQL server2012 2018-06-17
- Decimal Basic 学习笔记(1) 2018-06-17
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash