- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 pyqtgraph,我想在散点图的图例中添加一个项目。
我改编了示例代码来演示:
# -*- coding: utf-8 -*-
"""
Demonstrates basic use of LegendItem
"""
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
plt = pg.plot()
plt.setWindowTitle('pyqtgraph example: Legend')
plt.addLegend()
c1 = plt.plot([1,3,2,4], pen='r', name='red plot')
c2 = plt.plot([2,1,4,3], pen='g', fillLevel=0, fillBrush=(255,255,255,30), name='green plot')
c3 = plt.plot([4,3,2,1], pen=None, symbol='o', symbolPen='y', symbolBrush='r', name="point plot")
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
我得到的结果是:
如何添加适当的图例项?
最佳答案
当前版本的 pyqtgraph 不支持此功能。但是,它在 unstable 分支中受支持。您可以从此处的不稳定分支复制 LegendItem.py:http://bazaar.launchpad.net/~luke-campagnola/pyqtgraph/inp/view/head:/pyqtgraph/graphicsItems/LegendItem.py
关于pyqtgraph:为散点图添加图例项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16698116/
So I am making a GUI using Pyqt6 and want to add graphs inside the Gui with other data, SO when I tr
我可以使用 ArrayToQPath 在 pyqtgraph 中绘制具有不同颜色的多个 channel 吗? path = pg.arrayToQPath(xdata.flatten(), ydata
最近我下载了pyqtgraph模块。我在解压文件夹后运行了构建和安装,但是当我运行一个像下面这样的简单示例时 import pyqtgraph as pg import numpy as np x =
我正在使用 pyqtgraph,我想在散点图的图例中添加一个项目。 我改编了示例代码来演示: # -*- coding: utf-8 -*- """ Demonstrates basic use of
我有一个 PyQtGraph 图,可以缩放或平移。它改变了它的范围。当情节改变其范围时,我不能以某种方式被人知道吗? 最佳答案 将您选择的方法(槽)连接到 PlotItem.sigRangeChang
我正在使用 pyqtgraph 来实时查看相机采集程序。大多数时候,我的图像由大量背景噪声和仅具有较高强度的几个像素的信号组成。出于这个原因,HistogramLUTItem 的部分对应于实际信号看起
pyqtgraph 示例包括如何使用沿 x 轴的变量和沿 y 轴的计数进行直方图,如下所示。有没有办法让变量沿 y 轴运行,计数沿 x 轴运行,fillLevel 填充到 y 轴? import py
我正在尝试将一些代码从使用 matplotlib 转换为 pyqtgraph,因为它应该更高效,并且它提供了更多的交互功能。我的代码大部分都已转换,但我遇到了运行缓慢的问题。重现此内容的一些代码: i
我有一个 python 类,它生成一个大小为 10000 的 numpy 数组并对其执行一些计算。该类有两个绘图方法,都使用 pyqtgraph 绘制整个数据 一次绘制数据段(200 个样本) 我想知
该示例使用文件 'QtChart.ui'(这很重要)Pyqtgraph 的小部件嵌入其中(这也很重要)。 问题:显示图形,但显示自纪元开始以来的秒数,而不是日期时间轴。 我设置变量 axis = pg
我想同步几个 pyqtgraph 图的 X 轴。当用户通过鼠标交互(例如鼠标在 x 轴上时滚动滚轮)重新缩放 X 轴时,我想为所有其他图分配相同的更改。那么我该怎么做呢? 我从下面的一个基本示例中导出
我最近在将 pyqt 从 PyQt4 更新到 PyQt5 后开始使用 PyQt5,并注意到使用 pyqtgraph 生成的所有图的轴位置存在持续错误(见附图)。 x 轴不会延伸到窗口底部,并且 y 轴
我正在尝试在 pyqtgraph 的 Dock 中的 ImageView() (或类似的)中显示 RGB numpy 数组。 总体思路是这样的代码: import pyqtgraph as pg fr
我正在使用 pyqtchart 进行第一次测试,但由于有关动画图表的文档很差,我遇到了一些问题。我构建了一个图表,显示“sin”、“cos”和“tan”函数(近似于正切值),为了使其生效,我构建了一个
在我的 ubuntu (14.04) 操作系统上使用 python 处理原始鼠标数据的史诗般的斗争中,在这里的大量帮助下我再次陷入困境。我似乎很难理解 pyqtgraph 的“简单性”。我想做的就是将
我正在寻找一种方法使我的曲面图项目根据高度改变颜色。以下是我当前的方法: def __init__(self, s): self.traces = dict() self.app =
标题中的问题。在下面的导入中,QtCore 和 QtGui 应该从 pyqtgraph 还是 PyQt5 导入? 我的代码工作正常,但看着这个我有不好的代码感觉 - 我不确定 pyqtgraph 如何
我正在使用 PyQtGraph 0.10 和 Py3.6,但在使用以下代码时遇到问题。 我有两个问题: 1) 五个图上的 addLegend() 仅显示一个空的小框, 2) showLabel(sho
我有以下 PyQtGraph 程序,它在移动 slider 时使红色方 block “移动”: import sys from PyQt5 import QtCore, QtWidgets from
我正在尝试使用 pyqtgraph 绘制时间序列。我读过 this , this和 this .但我不确定如何正确使用它。 我的情节是一个情节小部件,我这样使用它: graph.plot(aeroso
我是一名优秀的程序员,十分优秀!