forked from oss-slu/cv_zebrafish
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebengineDemo.py
More file actions
39 lines (28 loc) · 938 Bytes
/
webengineDemo.py
File metadata and controls
39 lines (28 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import *
import plotly.graph_objects as go
import numpy as np
import sys
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow,self).__init__(*args, **kwargs)
self.fig = go.Figure()
trace_num = 10
point_num = 4000
for i in range(trace_num):
self.fig.add_trace(
go.Scatter(
x = np.linspace(0, 1, point_num),
y = np.random.randn(point_num)+(i*5)
)
)
self.fig.update_layout(showlegend=False)
self.browser = QWebEngineView()
self.browser.setHtml(self.fig.to_html(include_plotlyjs='cdn'))
self.setCentralWidget(self.browser)
self.show()
app = QApplication(sys.argv)
window = MainWindow()
app.exec_()