Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在PlotItem内设置轴位置_Python_Pyqt4_Pyqtgraph - Fatal编程技术网

Python 如何在PlotItem内设置轴位置

Python 如何在PlotItem内设置轴位置,python,pyqt4,pyqtgraph,Python,Pyqt4,Pyqtgraph,我正在使用PyQt和pyqtgraph构建一个实时数据监控应用程序。GUI有三个PlotWidget,它们是垂直排列的 这些图显示了传感器的位置。第一个显示X坐标,第二个显示Y坐标,第三个显示Z坐标。横坐标是时间,这对于所有三个图都是相同的 我的问题是,三个坐标轴(即Y轴)的水平位置在PlotWidget内移动,并且不对齐。我假设这主要是由于Y轴记号标签,根据显示的位数,可能需要更多或更少的空间 这是一种固定或手动设置绘图轴位置的方法吗 多谢各位 作为参考,以下是我设置PlotItems的方式:

我正在使用PyQt和pyqtgraph构建一个实时数据监控应用程序。GUI有三个PlotWidget,它们是垂直排列的

这些图显示了传感器的位置。第一个显示X坐标,第二个显示Y坐标,第三个显示Z坐标。横坐标是时间,这对于所有三个图都是相同的

我的问题是,三个坐标轴(即Y轴)的水平位置在PlotWidget内移动,并且不对齐。我假设这主要是由于Y轴记号标签,根据显示的位数,可能需要更多或更少的空间

这是一种固定或手动设置绘图轴位置的方法吗

多谢各位

作为参考,以下是我设置PlotItems的方式:

ui.graphicsView\u x.setLabel(“左”,text=“x”,units=“m”)
ui.graphicsView_y.setLabel(“左”,text=“y”,units=“m”)
ui.graphicsView_z.setLabel(“左”,text=“z”,units=“m”)
ui.graphicsView\u x.setLabel(“底部”,text=“Time”,units=“s”)
ui.graphicsView_y.setLabel(“底部”,text=“Time”,units=“s”)
ui.graphicsView_z.setLabel(“底部”,text=“Time”,units=“s”)
##为速度创建绘图项:我们只调用setData方法进行数据显示
颜色=['r','g','b']
##传感器rx1
it_rx1_x=ui.graphicsView_x.plot(clear=False,pen=colors[0])
it_rx1_y=ui.graphicsView_y.plot(clear=False,pen=colors[0])
it_rx1_z=ui.graphicsView_z.plot(clear=False,pen=colors[0])
##传感器rx2
it_rx2_x=ui.graphicsView_x.plot(clear=False,pen=colors[1])
it_rx2_y=ui.graphicsView_y.plot(clear=False,pen=colors[1])
it_rx2_z=ui.graphicsView_z.plot(clear=False,pen=colors[1])
##传感器rx3
it_rx3_x=ui.graphicsView_x.plot(clear=False,pen=colors[2])
it_rx3_y=ui.graphicsView_y.plot(clear=False,pen=colors[2])
it_rx3_z=ui.graphicsView_z.plot(clear=False,pen=colors[2])
##链接轴,因此我们只需设置一个(本例中的x图)
vBx=ui.graphicsView\u x.getPlotItem().getViewBox()
vBy=ui.graphicsView\u y.getPlotItem().getViewBox()
vBz=ui.graphicsView_z.getPlotItem().getViewBox()
vBy.linkView(vBy.XAxis,vBx)
vBz.linkView(vBz.XAxis,vBx)
ui.graphicsView_x.show()
ui.graphicsView_y.show()
ui.graphicsView_z.show()
我是这样做的:

def updatePlots():
全局扩展数据
全局扩展数据
全局扩展数据
全局yData_Rx1_X
全球yData_Rx1_Y
全球yData_Rx1_Z
全局扩展数据
全局扩展数据
全局扩展数据
全球yData_Rx2_X
全球yData_Rx2_Y
全球yData_Rx2_Z
全局扩展数据\u Rx3\u X
全局扩展数据
全局扩展数据
全球yData_Rx3_X
全球yData_Rx3_Y
全球yData_Rx3_Z
##注意:我们链接了视口的X轴。要确定所有人的规模,
##仅操纵X坐标图。
graphWidth=ui.horizontalSlider.value()
##由于某些原因,当我们显示时,Y限制未正确自动调整
##只有整个数据时间序列的一部分(通过设置X限制
##仅显示感兴趣的数据)。
##因此,我们手动确定并设置Y限制
maxX=[]
maxY_x=[]
minY_x=[]
maxY_y=[]
minY_y=[]
maxY_z=[]
minY_z=[]
如果ui.rx1\u checkBox.isChecked()和len(扩展数据rx1\u X)>0:
X,Y=截断数据(扩展数据,yData,图形宽度)
设置数据(np.hstack(x),np.hstack(Y))
maxX.append(最大(X))
最大附加(最大(Y))
minY_x.append(min(Y))
X,Y=截断数据(扩展数据,yData,图形宽度)
设置数据(np.hstack(X),np.hstack(y))
最大附加(最大(y))
minY_y.追加(min(y))
X,Y=截断数据(扩展数据,yData,图形宽度)
设置数据(np.hstack(X),np.hstack(Y))
最大附加(最大(Y))
minY_z.追加(min(Y))
如果ui.rx2\u checkBox.isChecked()和len(扩展数据rx2\u X)>0:
X,Y=截断数据(扩展数据,yData,图形宽度)
设置数据(np.hstack(x),np.hstack(Y))
maxX.append(最大(X))
最大附加(最大(Y))
minY_x.append(min(Y))
X,Y=截断数据(扩展数据,yData,图形宽度)
设置数据(np.hstack(X),np.hstack(y))
最大附加(最大(y))
minY_y.追加(min(y))
X,Y=截断数据(扩展数据,yData,图形宽度)
设置数据(np.hstack(X),np.hstack(Y))
最大附加(最大(Y))
minY_z.追加(min(Y))
如果ui.rx3\u checkBox.isChecked()和len(扩展数据rx3\u X)>0:
X,Y=截断数据(扩展数据,yData,图形宽度)
设置数据(np.hstack(x),np.hstack(Y))
maxX.append(最大(X))
最大附加(最大(Y))
minY_x.append(min(Y))
X,Y=截断数据(扩展数据,yData,图形宽度)
设置数据(np.hstack(X),np.hstack(y))
最大附加(最大(y))
minY_y.追加(min(y))
X,Y=截断数据(扩展数据,yData,图形宽度)
it_rx3_z.setData(np.hstack(xData_rx3_z),np.hstack(yData_rx3_z))
设置数据(np.hstack(X),np.hstack(Y))
最大附加(最大(Y))
minY_z.追加(min(Y))
##取消选中该框时临时删除曲线
如果不是ui.rx1\u checkBox.isChecked()和len(扩展数据rx1\u X)>0:
it_rx1_x.setData([],[])
it_rx1_y.设置数据([],[])
it_rx1_z.setData([],[])
如果不是ui.rx2\u checkBox.isChecked()和len(扩展数据rx2\u X)>0:
it_rx2_x.setData([],[])
it_rx2_y.设置数据([],[])
it_rx2_z.setData([],[])
如果不是ui.rx3\u checkBox.isChecked()和len(扩展数据rx3\u X)>0:
it_rx3_x.setData([],[])
it_rx3_y.设置数据([],[])
it_rx3_z.setData([],[])
如果len(maxX)>0:
##视图框已链接,只需设置x打印限制
ui.graphicsView_x.setXRange(最大值(maxX)-图形宽度,最大值(maxX))
如果len(minY_x)>0:
ui.graphicsView_x.setYRange(最小值(minY_x),最大值(maxY_x))
import time
import datetime
import numpy as np


import dbus

from dbus.mainloop.qt import DBusQtMainLoop
from PyQt4 import QtCore, QtDBus, QtGui
import pyqtgraph as pg

from upy018_gui import *
import sys



def appendData(X,Y,x,y,maxX):


    if len(X) == 0:
        Xlist = [x]
        Ylist = [y]
    else:

        X.append(x)
        Y.append(y)
        Xarray = np.array(X)

        Yarray = np.array(Y)




        ind, = (Xarray >= Xarray.max() - float(maxX)).nonzero()

        Xarray = Xarray[ind]
        Yarray = Yarray[ind]


        Xlist = Xarray.tolist()
        Ylist = Yarray.tolist()

    return Xlist, Ylist

def truncateData(X,Y,maxX):

    if len(X) > 0:
        Xarray = np.array(X)
        Yarray = np.array(Y)

        ind, = (Xarray >= Xarray.max() - float(maxX)).nonzero()

        Xarray = Xarray[ind]
        Yarray = Yarray[ind]

        Xlist = Xarray.tolist()
        Ylist = Yarray.tolist()

    else:
        Xlist = X
        Ylist = Y
    return Xlist, Ylist


def updatePnO(*arg):

    global maxLengthStored

    global pauseDisplay

    global xData_Rx1_X
    global xData_Rx1_Y
    global xData_Rx1_Z

    global yData_Rx1_X
    global yData_Rx1_Y
    global yData_Rx1_Z

    global xData_Rx2_X
    global xData_Rx2_Y
    global xData_Rx2_Z

    global yData_Rx2_X
    global yData_Rx2_Y
    global yData_Rx2_Z

    global xData_Rx3_X
    global xData_Rx3_Y
    global xData_Rx3_Z

    global yData_Rx3_X
    global yData_Rx3_Y
    global yData_Rx3_Z


    global numUpdatesReceived
    global numReceiversAttached

    receiverID = int(arg[0])

    numUpdatesReceived += 1

    x_update = float(arg[2]) / 1000
    y_update = float(arg[3]) / 1000
    z_update = float(arg[4]) / 1000


    if receiverID == 1:

        xData_Rx1_X,yData_Rx1_X = appendData(xData_Rx1_X,yData_Rx1_X,time.time(),x_update,maxLengthStored)
        xData_Rx1_Y,yData_Rx1_Y = appendData(xData_Rx1_Y,yData_Rx1_Y,time.time(),y_update,maxLengthStored)
        xData_Rx1_Z,yData_Rx1_Z = appendData(xData_Rx1_Z,yData_Rx1_Z,time.time(),z_update,maxLengthStored)


    if receiverID == 2:

        xData_Rx2_X,yData_Rx2_X = appendData(xData_Rx2_X,yData_Rx2_X,time.time(),x_update,maxLengthStored)
        xData_Rx2_Y,yData_Rx2_Y = appendData(xData_Rx2_Y,yData_Rx2_Y,time.time(),y_update,maxLengthStored)
        xData_Rx2_Z,yData_Rx2_Z = appendData(xData_Rx2_Z,yData_Rx2_Z,time.time(),z_update,maxLengthStored)

    if receiverID == 3:

        xData_Rx3_X,yData_Rx3_X = appendData(xData_Rx3_X,yData_Rx3_X,time.time(),x_update,maxLengthStored)
        xData_Rx3_Y,yData_Rx3_Y = appendData(xData_Rx3_Y,yData_Rx3_Y,time.time(),y_update,maxLengthStored)
        xData_Rx3_Z,yData_Rx3_Z = appendData(xData_Rx3_Z,yData_Rx3_Z,time.time(),z_update,maxLengthStored)


    ## only update graphs when we have received an update to all connected receivers
    if not pauseDisplay and numUpdatesReceived == numReceiversAttached:
        updatePlots()

    if numUpdatesReceived >= numReceiversAttached: # can be larger, if we disconnect a receiver at the wrong moment
        numUpdatesReceived = 0


def updatePlots():

    global xData_Rx1_X
    global xData_Rx1_Y
    global xData_Rx1_Z

    global yData_Rx1_X
    global yData_Rx1_Y
    global yData_Rx1_Z

    global xData_Rx2_X
    global xData_Rx2_Y
    global xData_Rx2_Z

    global yData_Rx2_X
    global yData_Rx2_Y
    global yData_Rx2_Z

    global xData_Rx3_X
    global xData_Rx3_Y
    global xData_Rx3_Z

    global yData_Rx3_X
    global yData_Rx3_Y
    global yData_Rx3_Z

    ## Note: we linked the X axes of the ViewBoxes.  To set the scale of all, only manipulate the X coordinate plot.

    graphWidth = ui.horizontalSlider.value()


    ## For some reason, Y limits are not properly auto-adjusted when
    ## we show only a portion of the entire data time series (by setting the X-limits to show only the data of interest).
    ## For this reason, we manually determine and set Y limits 
    maxX = []
    maxY_x = []
    minY_x = []

    maxY_y = []
    minY_y = []

    maxY_z = []
    minY_z = []




    if ui.rx1_checkBox.isChecked() and len(xData_Rx1_X) > 0:
        X , Y = truncateData(xData_Rx1_X,yData_Rx1_X,graphWidth)
        it_rx1_x.setData(np.hstack(X),np.hstack(Y))

        maxX.append(max(X))
        maxY_x.append(max(Y))
        minY_x.append(min(Y))

        X , Y = truncateData(xData_Rx1_Y,yData_Rx1_Y,graphWidth)
        it_rx1_y.setData(np.hstack(X),np.hstack(Y))
        maxY_y.append(max(Y))
        minY_y.append(min(Y))

        X , Y = truncateData(xData_Rx1_Z,yData_Rx1_Z,graphWidth)
        it_rx1_z.setData(np.hstack(X),np.hstack(Y))
        maxY_z.append(max(Y))
        minY_z.append(min(Y))



    if ui.rx2_checkBox.isChecked() and len(xData_Rx2_X) > 0:
        X , Y = truncateData(xData_Rx2_X,yData_Rx2_X,graphWidth)
        it_rx2_x.setData(np.hstack(X),np.hstack(Y))
        maxX.append(max(X))
        maxY_x.append(max(Y))
        minY_x.append(min(Y))

        X , Y = truncateData(xData_Rx2_Y,yData_Rx2_Y,graphWidth)
        it_rx2_y.setData(np.hstack(X),np.hstack(Y))
        maxY_y.append(max(Y))
        minY_y.append(min(Y))

        X , Y = truncateData(xData_Rx2_Z,yData_Rx2_Z,graphWidth)
        it_rx2_z.setData(np.hstack(X),np.hstack(Y))
        maxY_z.append(max(Y))
        minY_z.append(min(Y))

    if ui.rx3_checkBox.isChecked() and len(xData_Rx3_X) > 0:

        X , Y = truncateData(xData_Rx3_X,yData_Rx3_X,graphWidth)
        it_rx3_x.setData(np.hstack(X),np.hstack(Y))
        maxX.append(max(X))
        maxY_x.append(max(Y))
        minY_x.append(min(Y))

        X , Y = truncateData(xData_Rx3_Y,yData_Rx3_Y,graphWidth)
        it_rx3_y.setData(np.hstack(X),np.hstack(Y))
        maxY_y.append(max(Y))
        minY_y.append(min(Y))

        X , Y = truncateData(xData_Rx3_Z,yData_Rx3_Z,graphWidth)
        it_rx3_z.setData(np.hstack(xData_Rx3_Z),np.hstack(yData_Rx3_Z))
        it_rx3_z.setData(np.hstack(X),np.hstack(Y))
        maxY_z.append(max(Y))
        minY_z.append(min(Y))


    ## temporarily delete curves when box is unchecked
    if not ui.rx1_checkBox.isChecked() and len(xData_Rx1_X) > 0:
        it_rx1_x.setData([],[])
        it_rx1_y.setData([],[])
        it_rx1_z.setData([],[])

    if not ui.rx2_checkBox.isChecked() and len(xData_Rx2_X) > 0:
        it_rx2_x.setData([],[])
        it_rx2_y.setData([],[])
        it_rx2_z.setData([],[])

    if not ui.rx3_checkBox.isChecked() and len(xData_Rx3_X) > 0:
        it_rx3_x.setData([],[])
        it_rx3_y.setData([],[])
        it_rx3_z.setData([],[])


    if len(maxX) > 0:
        ## the view boxes are linked, just need to set x plot limits
        ui.graphicsView_x.setXRange(max(maxX) - graphWidth, max(maxX)) 

    if len(minY_x) > 0:
        ui.graphicsView_x.setYRange(min(minY_x), max(maxY_x))
    if len(minY_y) > 0:
        ui.graphicsView_y.setYRange(min(minY_y), max(maxY_y))
    if len(minY_z) > 0:
        ui.graphicsView_z.setYRange(min(minY_z), max(maxY_z))


def sliderAdjusted():
    global graphWidth
    graphWidth = float(ui.horizontalSlider.value())
    thestring = "Window width: %d s" % graphWidth
    ui.graphWidth_label.setText(thestring)

def clickedOnGraph_x(self):
    pass
def clickedOnGraph_y(self):
    pass
def clickedOnGraph_z(self):
    pass



def pause():
    global pauseDisplay

    global launchTime

    global xData_Rx1_X
    global xData_Rx1_Y
    global xData_Rx1_Z

    global yData_Rx1_X
    global yData_Rx1_Y
    global yData_Rx1_Z

    global xData_Rx2_X
    global xData_Rx2_Y
    global xData_Rx2_Z

    global yData_Rx2_X
    global yData_Rx2_Y
    global yData_Rx2_Z

    global xData_Rx3_X
    global xData_Rx3_Y
    global xData_Rx3_Z

    global yData_Rx3_X
    global yData_Rx3_Y
    global yData_Rx3_Z





    pauseDisplay = True
    ui.pause_toolButton.hide()
    ui.graphWidth_label.hide()
    ui.start_toolButton.show()
    ui.horizontalSlider.hide()


    ui.graphicsView_x.getViewBox().enableAutoRange()
    ui.graphicsView_y.getViewBox().enableAutoRange()
    ui.graphicsView_z.getViewBox().enableAutoRange()

    if ui.rx1_checkBox.isChecked() and len(xData_Rx1_X) > 0:
        it_rx1_x.setData(np.hstack(xData_Rx1_X)-launchTime,np.hstack(yData_Rx1_X))
        it_rx1_y.setData(np.hstack(xData_Rx1_Y)-launchTime,np.hstack(yData_Rx1_Y))
        it_rx1_z.setData(np.hstack(xData_Rx1_Z)-launchTime,np.hstack(yData_Rx1_Z))


    if ui.rx2_checkBox.isChecked() and len(xData_Rx2_X) > 0:
        it_rx2_x.setData(np.hstack(xData_Rx2_X)-launchTime,np.hstack(yData_Rx2_X))
        it_rx2_y.setData(np.hstack(xData_Rx2_Y)-launchTime,np.hstack(yData_Rx2_Y))
        it_rx2_z.setData(np.hstack(xData_Rx2_Z)-launchTime,np.hstack(yData_Rx2_Z))


    if ui.rx3_checkBox.isChecked() and len(xData_Rx3_X) > 0:
        it_rx3_x.setData(np.hstack(xData_Rx3_X)-launchTime,np.hstack(yData_Rx3_X))
        it_rx3_y.setData(np.hstack(xData_Rx3_Y)-launchTime,np.hstack(yData_Rx3_Y))
        it_rx3_z.setData(np.hstack(xData_Rx3_Z)-launchTime,np.hstack(yData_Rx3_Z))

    ## temporarily delete curves when box is unchecked
    if not ui.rx1_checkBox.isChecked() and len(xData_Rx1_X) > 0:
        it_rx1_x.setData([],[])
        it_rx1_y.setData([],[])
        it_rx1_z.setData([],[])

    if not ui.rx2_checkBox.isChecked() and len(xData_Rx2_X) > 0:
        it_rx2_x.setData([],[])
        it_rx2_y.setData([],[])
        it_rx2_z.setData([],[])

    if not ui.rx3_checkBox.isChecked() and len(xData_Rx3_X) > 0:
        it_rx3_x.setData([],[])
        it_rx3_y.setData([],[])
        it_rx3_z.setData([],[])

    ui.graphicsView_x.getPlotItem().showAxis('bottom', show=True)
    ui.graphicsView_y.getPlotItem().showAxis('bottom', show=True)
    ui.graphicsView_z.getPlotItem().showAxis('bottom', show=True)

    #print(ui.graphicsView_x.getPlotItem().viewRange())

def restart():
    global pauseDisplay
    pauseDisplay = False
    ui.pause_toolButton.show()
    ui.graphWidth_label.show()
    ui.start_toolButton.hide()
    ui.horizontalSlider.show()

    ui.graphicsView_x.getPlotItem().showAxis('bottom', show=False)
    ui.graphicsView_y.getPlotItem().showAxis('bottom', show=False)
    ui.graphicsView_z.getPlotItem().showAxis('bottom', show=False)


def getOut():
    app.quit()

# ======================================= #
#                                         #
#                MAIN                     #
#                                         #
# ======================================= #


if __name__ == '__main__':


    ## Global variables
    graphWidthMax = 45. # maximum data length that can be shown while data acquisition is running (seconds)
    graphWidth = 30. # data length shown in graph at program launch (seconds)
    maxLengthStored = 120.# stores up to this many seconds worth of data
    pauseDisplay = False

    numUpdatesReceived = 0
    numReceiversAttached = 0

    xData_Rx1_X = []
    xData_Rx1_Y = []
    xData_Rx1_Z = []

    yData_Rx1_X = []
    yData_Rx1_Y = []
    yData_Rx1_Z = []

    xData_Rx2_X = []
    xData_Rx2_Y = []
    xData_Rx2_Z = []

    yData_Rx2_X = []
    yData_Rx2_Y = []
    yData_Rx2_Z = []

    xData_Rx3_X = []
    xData_Rx3_Y = []
    xData_Rx3_Z = []

    yData_Rx3_X = []
    yData_Rx3_Y = []
    yData_Rx3_Z = []

    ## Create application
    app = QtGui.QApplication(sys.argv)
    MainWindow = QtGui.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)


    DBusQtMainLoop(set_as_default=True)     


    ## set up DBus communication    
    bus = dbus.SessionBus()     

    signalReceiver_positionAndOrientationUpdate = bus.add_signal_receiver(updatePnO,"positionUpdate","tcf.PositionService","tcf.PositionService","/")

    ## Construct an interface object for method calls
    #     First, obtain proxy object
    remote_object = bus.get_object("tcf.PositionService", "/")
    trackerService = dbus.Interface(remote_object, 'tcf.PositionService')

    ui.quit_pushButton.connect(ui.quit_pushButton,QtCore.SIGNAL("clicked()"),getOut)



    ui.horizontalSlider.setMaximum(graphWidthMax)
    ui.horizontalSlider.setMinimum(5)
    ui.horizontalSlider.setValue(graphWidth)
    ui.horizontalSlider.connect(ui.horizontalSlider,QtCore.SIGNAL("valueChanged(int)"),sliderAdjusted)

    enableChangeCheckBoxes("initialize")


    thestring = "Window width: %d s" % graphWidth
    ui.graphWidth_label.setText(thestring)


    icon = QtGui.QIcon('./upy018_ICON_pause.png')
    ui.pause_toolButton.setIcon(icon)
    ui.pause_toolButton.connect(ui.pause_toolButton,QtCore.SIGNAL("clicked()"),pause)


    icon = QtGui.QIcon('./upy018_ICON_play.png')
    ui.start_toolButton.setIcon(icon)
    ui.start_toolButton.hide()
    ui.start_toolButton.connect(ui.start_toolButton,QtCore.SIGNAL("clicked()"),restart)


    ## Set up P&O graphs




    ui.graphicsView_x.setLabel("left", text="X", units="m")
    ui.graphicsView_y.setLabel("left", text="Y", units="m")
    ui.graphicsView_z.setLabel("left", text="Z", units="m")

    ui.graphicsView_x.setLabel("bottom", text="Time", units="s")
    ui.graphicsView_y.setLabel("bottom", text="Time", units="s")
    ui.graphicsView_z.setLabel("bottom", text="Time", units="s")

    #ui.graphicsView_x.getPlotItem().getAxis('left').setWidth(100)
    #ui.graphicsView_y.getPlotItem().getAxis('left').setWidth(100)
    #ui.graphicsView_z.getPlotItem().getAxis('left').setWidth(100)

    ## Create plot items for speed: we'll only call setData method for data display
    colors = ['r','g','b']
    it_rx1_x = ui.graphicsView_x.plot(clear=False, pen=colors[0])
    it_rx1_y = ui.graphicsView_y.plot(clear=False, pen=colors[0])
    it_rx1_z = ui.graphicsView_z.plot(clear=False, pen=colors[0])

    it_rx2_x = ui.graphicsView_x.plot(clear=False, pen=colors[1])
    it_rx2_y = ui.graphicsView_y.plot(clear=False, pen=colors[1])
    it_rx2_z = ui.graphicsView_z.plot(clear=False, pen=colors[1])

    it_rx3_x = ui.graphicsView_x.plot(clear=False, pen=colors[2])
    it_rx3_y = ui.graphicsView_y.plot(clear=False, pen=colors[2])
    it_rx3_z = ui.graphicsView_z.plot(clear=False, pen=colors[2])

    ## Link axes, so we only have to set one (the x graph in this case)
    vBx = ui.graphicsView_x.getPlotItem().getViewBox()
    vBy = ui.graphicsView_y.getPlotItem().getViewBox()
    vBz = ui.graphicsView_z.getPlotItem().getViewBox()

    vBy.linkView(vBy.XAxis, vBx)
    vBz.linkView(vBz.XAxis, vBx)

    ui.graphicsView_y.setXLink(ui.graphicsView_x)
    ui.graphicsView_z.setXLink(ui.graphicsView_x)



    ## We don't show the X-label, unless we pause
    ui.graphicsView_x.getPlotItem().showAxis('bottom', show=False)
    ui.graphicsView_x.getPlotItem().showGrid(x=False, y=True, alpha=1.)

    ui.graphicsView_y.getPlotItem().showAxis('bottom', show=False)
    ui.graphicsView_y.getPlotItem().showGrid(x=False, y=True, alpha=1.)

    ui.graphicsView_z.getPlotItem().showAxis('bottom', show=False)
    ui.graphicsView_z.getPlotItem().showGrid(x=False, y=True, alpha=1.)

    ui.graphicsView_y.setXLink(ui.graphicsView_x)
    ui.graphicsView_z.setXLink(ui.graphicsView_x)

    ## The commands below will only be working in pyqtgraph version  0.9.9
    #ui.graphicsView_x.getPlotItem().getAxis('left').setStyle(tickTextWidth=60)
    #ui.graphicsView_y.getPlotItem().getAxis('left').setStyle(tickTextWidth=60)
    #ui.graphicsView_z.getPlotItem().getAxis('left').setStyle(tickTextWidth=60)

    #ui.graphicsView_x.getPlotItem().getAxis('left').setWidth(250)
    #vBx.disableAutoRange(vBx.XAxis)
    #vBy.disableAutoRange(vBy.XAxis)
    #vBz.disableAutoRange(vBz.XAxis)


    #ui.graphicsView_x.getPlotItem().getAxis('left').setTicks([[(0, 'zero'), (0.020, 'twenty')]])
    #ui.graphicsView_y.getPlotItem().getAxis('left').setTicks([[(1, 'one'), (2, 'two')]])
    #ui.graphicsView_z.getPlotItem().getAxis('left').setTicks([[(1, 'one'), (2, 'two')]])

    ui.graphicsView_x.show()
    ui.graphicsView_y.show()
    ui.graphicsView_z.show()

    launchTime = time.time()


    MainWindow.show()

    sys.exit(app.exec_())
ui.graphicsView_y.setXLink(ui.graphicsView_x)
ui.graphicsView_z.setXLink(ui.graphicsView_x)