Exemplo n.º 1
0
    def __init__(self, BSR_df, BSR_df_index):
        super(QtlPqge, self).__init__()
        self.resize(800, 550)
        self.setWindowTitle('qtl_seq')
        self.fig_1 = plt.Figure()
        self.canvas_1 = FC(self.fig_1)
        self.fig_2 = plt.Figure()
        self.canvas_2 = FC(self.fig_2)
        self.fig_3 = plt.Figure()
        self.canvas_3 = FC(self.fig_3)
        self.fig_4 = plt.Figure()
        self.canvas_4 = FC(self.fig_4)

        self.tab1 = QWidget()
        self.tab2 = QWidget()
        self.tab3 = QWidget()
        self.tab4 = QWidget()
        self.tab5 = QWidget()
        self.BSR_df = BSR_df
        self.BSR_df_index = BSR_df_index
        self.addTab(self.tab1, 'info')
        self.addTab(self.tab2, 'pool1')
        self.addTab(self.tab3, 'pool2')
        self.addTab(self.tab4, 'delta_snpindex')
        self.addTab(self.tab5, 'ed6')
        self.tab1UI()
        self.tab2UI()
        self.tab3UI()
        self.tab4UI()
        self.tab5UI()
Exemplo n.º 2
0
    def get_fig(self):

        df = self.daily_df

        fig = plt.Figure(figsize=(10, 16))
        canvas = FC(fig)

        balance_plot = fig.add_subplot(111)
        balance_plot.set_title("Balance")
        balance_plot.plot(df.index, df["balance"])
        # df["balance"].plot(legend=True)

        # drawdown_plot = fig.add_subplot(4, 1, 2)
        # drawdown_plot.set_title("Drawdown")
        # drawdown_plot.fill_between(range(len(df)), df["drawdown"].values)
        #
        # pnl_plot = fig.add_subplot(4, 1, 3)
        # pnl_plot.set_title("Daily Pnl")
        # df["net_pnl"].plot(kind="bar", legend=False, grid=False, xticks=[])
        #
        # distribution_plot = fig.add_subplot(4, 1, 4)
        # distribution_plot.set_title("Daily Pnl Distribution")
        # df["net_pnl"].hist(bins=50)

        return canvas
Exemplo n.º 3
0
    def __init__(self):
        # 从文件中加载定义的ui
        qfile_stats = QFile("ui/rz_end_test.ui")
        qfile_stats.open(QFile.ReadOnly)
        qfile_stats.close()

        # 从定义的Ui动态的创建相应的窗口对象
        # 注意: 控件的返回值是一个窗体的对象
        # 例如 self.ui.button  self.ui.textEdit
        self.ui = QUiLoader().load(qfile_stats)

        # 图标显示区域
        self.fig = plt.Figure()
        self.canvas = FC(self.fig)
        # self.ui.show_lable.to(self.ui)
        layout = QVBoxLayout(self.ui.show_lable)
        layout.addWidget(self.canvas)
        layout.setContentsMargins(0, 0, 0, 0)

        # 腾讯网数据显示按钮绑定事件
        self.ui.province.clicked.connect(self.tencent_province_data)
        self.ui.data_all.clicked.connect(self.tencent_all_data)
        self.ui.city.clicked.connect(self.tencent_city)

        # 微博数据显示按钮绑定事件
        self.ui.weibo_cloud.clicked.connect(self.weibo_cloud)
        self.ui.data_emotion.clicked.connect(self.weibo_emotion)
        self.ui.word_rank.clicked.connect(self.weibo_keyword)

        # 中国社会组织公共服务平台
        self.ui.tfidf.clicked.connect(self.news_tfidf)
        self.ui.news_cloud.clicked.connect(self.news_wordcloud)
        self.ui.LDA.clicked.connect(self.news_lda)
Exemplo n.º 4
0
    def initUI(self):
        layout = QVBoxLayout()

        self.plt = plt
        self.fig = plt.figure(num=1, figsize=(15, 8), dpi=80)
        self.canvas = FC(self.fig)
        layout.addWidget(self.canvas)

        self.setLayout(layout)
Exemplo n.º 5
0
    def init_ui(self):
        self.resize(800, 600)
        self.setWindowTitle('PyQt5 Draw')

        # TODO:这里是结合的关键
        '''
    self.fig = plt.Figure(figsize=(8,6)) # size 8*6 英寸
    img_file_name = 'Error_Analysis.png'
    if os.path.isfile(img_file_name):
      image = plt.imread(img_file_name)
      plt.axis('off')
      plt.tight_layout()
      im = plt.imshow(image)
    else:
      print("image %s not existing !" % img_file_name)
    '''
        '''
    
    # 背景图片无法显示出来,因为图形加载在 plot 里,它的对象无法获取

    self.fig = matplotlib.figure.Figure(figsize=(8,6)) # size 8*6 英寸
    self.ax = self.fig.add_subplot(111)
    img_file_name = 'Error_Analysis.png'
    if os.path.isfile(img_file_name):
      image = matplotlib.image.imread(img_file_name)
      plt.axis('off')
      plt.tight_layout()
      plt.imshow(image)
      #plt.show()
    else:
      print("image %s not existing !" % img_file_name)
    '''

        self.fig = matplotlib.figure.Figure(figsize=(8, 6))  # size 8*6 英寸
        self.ax = self.fig.add_subplot(111)
        #
        #  加载背景图片
        #
        image = matplotlib.image.imread('Error_Analysis.png')
        self.ax.axis('off')
        self.fig.set_tight_layout(True)
        self.ax.imshow(image)

        self.canvas = FC(self.fig)
        self.btn_start = QPushButton(self)
        self.btn_start.setText('draw')
        self.btn_start.clicked.connect(self.slot_btn_start)

        widget = QWidget()
        layout = QVBoxLayout()
        layout.addWidget(self.canvas)
        layout.addWidget(self.btn_start)
        widget.setLayout(layout)
        self.setCentralWidget(widget)
Exemplo n.º 6
0
    def init_plotBox(self):
        layout = QVBoxLayout()

        #m = TPSEPlot(self)
        self.plt = plt
        self.fig = plt.figure(num=1, figsize=(15, 8),dpi=80)  
        self.canvas = FC(self.fig)
        layout.addWidget(self.canvas)


        self.plotBox.setLayout(layout)
Exemplo n.º 7
0
 def __init__(self,mutmap_df,mutmap_df_index):
     super(MutmapPage,self).__init__()
     self.resize(800,550)
     self.setWindowTitle('mutmap')
     self.fig = plt.Figure()
     self.canvas = FC(self.fig)
     self.tab1=QWidget()
     self.tab2=QWidget()
     self.mutmap_df = mutmap_df
     self.mutmap_df_index = mutmap_df_index
     self.addTab(self.tab1, 'info')
     self.addTab(self.tab2, 'snp_index')
     self.tab1UI()
     self.tab2UI()
Exemplo n.º 8
0
 def __init__(self, BSR_df, BSR_df_index):
     super(BSRPage, self).__init__()
     self.resize(800, 550)
     self.setWindowTitle('bsr')
     self.fig = plt.Figure()
     self.canvas = FC(self.fig)
     self.tab1 = QWidget()
     self.tab2 = QWidget()
     self.BSR_df = BSR_df
     self.BSR_df_index = BSR_df_index
     self.addTab(self.tab1, 'info')
     self.addTab(self.tab2, 'ed6')
     self.tab1UI()
     self.tab2UI()
Exemplo n.º 9
0
    def Draw_data(self):
        # TODO:这里是结合的关键
        self.fig1 = plt.Figure()
        self.canvas1 = FC(self.fig1)
        self.fig2 = plt.Figure()
        self.canvas2 = FC(self.fig2)

        # 定时器绘制数据
        self.timer_draw = QTimer(self)
        self.timer_draw.timeout.connect(self.plot_start)
        self.timer_draw.start(0.1)

        # 定时器绘制数据
        self.timer_draw_3d = QTimer(self)
        self.timer_draw_3d.timeout.connect(self.plot_start_3d)
        self.timer_draw_3d.start(0.1)

        layout1 = QVBoxLayout()
        layout1.addWidget(self.canvas1)
        self.centralWidget1.setLayout(layout1)
        layout2 = QVBoxLayout()
        layout2.addWidget(self.canvas2)
        self.centralWidget2.setLayout(layout2)
        self.plot_start()
Exemplo n.º 10
0
    def init_ui(self):
        self.resize(800, 600)
        self.setWindowTitle('PyQt5 Draw')

        # TODO:这里是结合的关键
        self.fig = plt.Figure()
        self.canvas = FC(self.fig)
        self.btn_start = QPushButton(self)
        self.btn_start.setText('draw')
        self.btn_start.clicked.connect(self.slot_btn_start)

        widget = QWidget()
        layout = QVBoxLayout()
        layout.addWidget(self.canvas)
        layout.addWidget(self.btn_start)
        widget.setLayout(layout)
        self.setCentralWidget(widget)
Exemplo n.º 11
0
    def Draw_data(self):
        # TODO:这里是结合的关键
        self.fig = plt.Figure()
        self.canvas = FC(self.fig)

        # 定时器绘制数据
        self.timer_draw = QTimer(self)
        self.timer_draw.timeout.connect(self.plot_start)
        self.timer_draw.start(0.1)

        # # 定时器绘制数据
        # self.timer_draw_3d = QTimer(self)
        # self.timer_draw_3d.timeout.connect(self.pose_estimation_3d)
        # self.timer_draw_3d.start(0.1)
        self.pose_estimation_3d()

        layout = QVBoxLayout()
        layout.addWidget(self.canvas)
        self.centralWidget1.setLayout(layout)
        self.plot_start()
Exemplo n.º 12
0
    def __init__(self, circus_df):  #circus_df
        super(QtDraw, self).__init__()
        self.circus_df = circus_df
        self.resize(800, 550)
        self.fig = plt.Figure(tight_layout=True)
        self.canvas = FC(self.fig)

        self.setWindowTitle('circus')
        self.tools_layout = QHBoxLayout()

        self.btn_start = QPushButton('draw')
        self.down_botton = QPushButton('download')

        self.tools_layout.addWidget(self.btn_start)
        self.tools_layout.addWidget(self.down_botton)
        self.btn_start.clicked.connect(self.circus)
        self.down_botton.clicked.connect(self.download)
        self.draw_layout = QVBoxLayout()
        self.draw_layout.addWidget(self.canvas)

        self.layout = QVBoxLayout()
        self.layout.addLayout(self.draw_layout)
        self.layout.addLayout(self.tools_layout)
        self.setLayout(self.layout)
Exemplo n.º 13
0
    def initUI(self):
        self.setWindowIcon(QIcon('../icon.PNG'))
        self.setWindowTitle('Robot Tool')
        self.setGeometry(400, 400, 600, 400)
        # 设置第一行
        self.IPLineEdit = QLineEdit()
        self.PortLineEdit = QLineEdit()
        self.CurLineEdit = QLineEdit()
        self.connectButton = QPushButton('连接')
        self.disconnectButton = QPushButton('断开')
        ipLable = QLabel('IP:', self)
        portLable = QLabel('&Port:', self)
        disconnectButtonLable = QLabel('Current:', self)
        ipLable.setBuddy(self.IPLineEdit)
        portLable.setBuddy(self.PortLineEdit)
        disconnectButtonLable.setBuddy(self.PortLineEdit)
        spacerLeft = QSpacerItem(20, 20, QSizePolicy.Expanding)
        # spacerLeft.setGeometry(20)
        # 设置行layout
        h_layout_1 = QHBoxLayout()
        h_layout_1.addSpacerItem(spacerLeft)
        h_layout_1.addWidget(ipLable)
        h_layout_1.addWidget(self.IPLineEdit)
        h_layout_1.addSpacerItem(spacerLeft)
        h_layout_1.addWidget(portLable)
        h_layout_1.addWidget(self.PortLineEdit)
        h_layout_1.addSpacerItem(spacerLeft)
        h_layout_1.addWidget(self.connectButton)
        h_layout_1.addSpacerItem(spacerLeft)
        h_layout_1.addWidget(disconnectButtonLable)
        h_layout_1.addWidget(self.CurLineEdit)
        h_layout_1.addWidget(self.disconnectButton)
        h_layout_1.addSpacerItem(spacerLeft)
        # 设置第二行
        # h_layout_2 = QHBoxLayout()
        # self.connectSignalOut = QTextEdit()
        # spacer2 = QSpacerItem(20, 40, QSizePolicy.Fixed)
        # # self.connectSignalOut.setSizeIncrement(400, 100)
        # h_layout_2.addSpacerItem(spacer2)
        # h_layout_2.addWidget(self.connectSignalOut)
        # h_layout_2.addSpacerItem(spacer2)
        self.selectButton = QPushButton('选择文件')
        self.displayButton = QPushButton('画图')
        self.filePathlineEdit = QLineEdit()
        self.filePathlineEdit.setPlaceholderText('当前文件框')
        spacer2 = QSpacerItem(20, 40, QSizePolicy.Fixed)
        # self.connectSignalOut.setSizeIncrement(400, 100)
        h_layout_3 = QHBoxLayout()
        h_layout_3.addSpacerItem(spacer2)
        h_layout_3.addWidget(self.selectButton)
        h_layout_3.addWidget(self.filePathlineEdit)
        h_layout_3.addSpacerItem(spacer2)
        h_layout_3.addWidget(self.displayButton)
        # set the slot of connect button
        # connectButton.clicked.connect(self.connectRobot)
        self.fig = plt.figure(figsize=(5, 4))
        self.canvas = FC(self.fig)
        self.axes = self.fig.add_subplot('111')
        self.axes.set_title('plot')
        VLayout = QVBoxLayout()
        VLayout.addLayout(h_layout_1)
        # VLayout.addStretch(1)
        # VLayout.addLayout(h_layout_2)
        # VLayout.addStretch(10)
        VLayout.addLayout(h_layout_3)
        # VLayout.addStretch(1)
        VLayout.addWidget(self.canvas)
        self.setLayout(VLayout)

        self.centerScreen()
        self.ip_port_validator()

        self.selectButton.clicked.connect(self.openFile)
        self.displayButton.clicked.connect(self.dispaly)
Exemplo n.º 14
0
    def setupUi(self, MainWindow, qCmd, qSend, qRecv):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1600, 900)
        #_translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle("OSDR控制面板")

        font = QtGui.QFont()
        font.setFamily("微软雅黑")
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)

        self.cmd = qCmd
        self.send = qSend
        self.recv = qRecv

        for i in self.item:
            label = QtWidgets.QLabel(MainWindow)
            label.setText(i["text"])
            label.setGeometry(QtCore.QRect(i['x'], i['y'], 110, 60))
            label.setFont(font)

            if ('entry' in i):
                lineEdit = QtWidgets.QLineEdit(MainWindow)
                lineEdit.setText(i['default'])
                lineEdit.setGeometry(
                    QtCore.QRect(i['x'] + 120, i['y'] + 15, 160, 20))
                lineEdit.setFont(font)
                i['handle'] = lineEdit

            elif ('scale' in i):
                i["label"] = QtWidgets.QLabel(MainWindow)
                i["label"].setText("15")
                i["label"].setGeometry(
                    QtCore.QRect(i['x'] + 260, i['y'] + 15, 20, 20))
                i["label"].setFont(font)

                i["handle"] = QtWidgets.QSlider(MainWindow)
                i["handle"].setGeometry(
                    QtCore.QRect(i['x'] + 120, i['y'] + 15, 130, 20))
                i["handle"].setOrientation(QtCore.Qt.Horizontal)
                i["handle"].setMaximum(i['scale'][1])
                i["handle"].setSingleStep(i['scale'][2])
                i["handle"].setTickPosition(QtWidgets.QSlider.TicksAbove)
                i["handle"].setFont(font)
                #i["handle"].valueChanged.connect(lambda: self.onSliderChange(i["handle"], i["lable"]))

            elif ('combo' in i):
                comboBox = QtWidgets.QComboBox(MainWindow)
                comboBox.setGeometry(
                    QtCore.QRect(i['x'] + 120, i['y'] + 15, 160, 20))
                comboBox.setObjectName("comboBox")
                for s in i['combo']:
                    comboBox.addItem(s)
                comboBox.setCurrentIndex(i["default"])
                comboBox.setFont(font)
                i["handle"] = comboBox

        self.button_set = QtWidgets.QPushButton(MainWindow)
        self.button_set.setGeometry(QtCore.QRect(210, 660, 100, 30))
        self.button_set.setText("设置")
        self.button_set.setFont(font)
        self.button_set.clicked.connect(self.onclick_set)

        label = QtWidgets.QLabel(MainWindow)
        label.setText("长度")
        label.setGeometry(QtCore.QRect(30, 710, 30, 30))
        label.setFont(font)

        self.lineEdit_size = QtWidgets.QLineEdit(MainWindow)
        self.lineEdit_size.setText("16384")
        self.lineEdit_size.setGeometry(QtCore.QRect(70, 710, 60, 30))
        self.lineEdit_size.setFont(font)

        self.button_save = QtWidgets.QPushButton(MainWindow)
        self.button_save.setGeometry(QtCore.QRect(140, 710, 60, 30))
        self.button_save.setText("保存波形")
        self.button_save.setFont(font)
        self.button_save.clicked.connect(self.onclick_save)

        self.button_recv = QtWidgets.QPushButton(MainWindow)
        self.button_recv.setGeometry(QtCore.QRect(210, 710, 100, 30))
        self.button_recv.setText("接收")
        self.button_recv.setFont(font)
        self.button_recv.clicked.connect(self.onclick_recv)

        self.lineEdit_file = QtWidgets.QLineEdit(MainWindow)
        self.lineEdit_file.setText(" ")
        self.lineEdit_file.setGeometry(QtCore.QRect(30, 760, 100, 30))
        self.lineEdit_file.setFont(font)

        self.button_file = QtWidgets.QPushButton(MainWindow)
        self.button_file.setGeometry(QtCore.QRect(140, 760, 60, 30))
        self.button_file.setText("选择文件")
        self.button_file.setFont(font)
        self.button_file.clicked.connect(self.onclick_file)

        self.button_send = QtWidgets.QPushButton(MainWindow)
        self.button_send.setGeometry(QtCore.QRect(210, 760, 100, 30))
        self.button_send.setText("发送")
        self.button_send.setFont(font)
        self.button_send.clicked.connect(self.onclick_send)

        self.label_state = QtWidgets.QLabel(MainWindow)
        self.label_state.setText("OSDR未连接")
        self.label_state.setGeometry(QtCore.QRect(30, 810, 350, 30))
        self.label_state.setFont(font)

        self.fig = plt.Figure()
        self.canvas = FC(self.fig)
        layout = QVBoxLayout()
        layout.addWidget(self.canvas)

        self.widget = QtWidgets.QWidget(MainWindow)
        self.widget.setGeometry(QtCore.QRect(350, 50, 1200, 800))
        self.widget.setObjectName("widget")
        self.widget.setLayout(layout)

        self.message_str = None
        self.message = message(self)
        self.message.signal.connect(self.ui_message_show)

        QtCore.QMetaObject.connectSlotsByName(MainWindow)