PyQtGraph Basic Realization[2]
程序员文章站
2022-03-16 23:12:24
Profile Last Time We managed to add logic wave in the GraphicsLayoutWidget. Today We Try to add Curve for the GraphicsLayoutWidgets. First Step We Nee ......
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 |
上一篇: Oracle 使用 dblink详解
推荐阅读
-
L2CAP蓝牙协议的 basic mode 基本模式数据格式
-
.NET Core ASP.NET Core Basic 1-2 控制反转与依赖注入
-
【open3d-basic】2-pointcloud
-
PyQtGraph Basic Realization[2]
-
Yii2 basic Login 示例的代码疑问
-
YII2 Advanced应用怎么改成Basic版的
-
PyQtGraph Basic Realization
-
[NIO.2] 第十二篇 NIO.2 属性视图之 Basic View
-
Yii2 basic版登录使用Yii::$app->user->login($user);出现错误
-
C++Primer 5th Chap2 Variables and basic Types