- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
PyQtgraph Y 轴标签以科学计数法显示。我不希望它采用科学记数法。将标签更改为非科学的代码是什么。
科学计数法 - 1.70 (x1e+06)
非科学记数法1700000(我想以非科学记数法显示Y轴)。
在 main() 函数中,我调用 addXYZ 来添加等高线,然后调用 Show2dPlot 来显示等高线图。
##### add the XY contour line to plot #####
def addXYZ(self, X, Y, Z):
self.plotwin.plot(X, Y, pen=(255,255,255))#cmap=cm.coolwarm)
##### Format 2D Plot #####
def Show2dPlot(self):
self.plotwin.setLogMode(x=False, y=False)
self.plotwin.showGrid(x=True, y=True)
self.plotwin.setLabel('left', "Easting")# units='A')
self.plotwin.setLabel('bottom', "Northing") #, units='s')
self.plotwin.setAspectLocked()
self.plotwin.set_scientific(False) #I'm getting error in set_scientific
最佳答案
PyQtgraph 不包含 set_scientific(False)。最好的解决方案是覆盖 AxisItem.tickStrings 将有助于创建自定义标签。
下面是代码。
import sys
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
##### Override class #####
class NonScientific(pg.AxisItem):
def __init__(self, *args, **kwargs):
super(NonScientific, self).__init__(*args, **kwargs)
def tickStrings(self, values, scale, spacing):
return [int(value*1) for value in values] #This line return the NonScientific notation value
class MyApplication(QtGui.QApplication):
def __init__(self, *args, **kwargs):
self.win = pg.GraphicsWindow(title="Contour plotting")
self.win.resize(1000,600)
self.plot = self.win.addPlot(title='Contour', axisItems={'left': NonScientific(orientation='left')})
self.curve = self.plot.plot()
def PlotContour(self):
x = range(50000,60000,10000)#X coordinates of contour
y = range(500000,600000,100000)#Y coordinates of contour
self.curve.setData(x=x, y=y)
self.curve.autoRange()
def main():
app = MyApplication(sys.argv)
sys.exit(app.exec_())
if __name__ == '__main__':
main()
关于python - PyQtgraph y轴标签非科学计数法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43778148/
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
我是一名优秀的程序员,十分优秀!