Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
numpyMatrix = df.as_matrix()
newdf = pd.concat([df.SiO2 ,df.Ratio, df.CaO], axis=1)
X= newdf.as_matrix()
## Define a top-level widget to hold everything
w = QtGui.QWidget()
## Create some widgets to be placed inside
btn = QtGui.QPushButton('press me')
text = QtGui.QLineEdit('enter text')
listw = QtGui.QListWidget()
view = pg.PlotWidget()
view.addLegend()
view.plot(X[:, 0], X[:,2], pen=None, symbol='o', symbolPen=None, symbolSize=10, symbolBrush=(100, 255, 255, 88), name=y[0])
## Create a grid layout to manage the widgets size and position
layout = QtGui.QGridLayout()
w.setLayout(layout)
## Add widgets to the layout in their proper positions
layout.addWidget(btn, 0, 0) # button goes in upper-left
layout.addWidget(text, 1, 0) # text edit goes in middle-left
layout.addWidget(listw, 2, 0) # list widget goes in bottom-left
layout.addWidget(view, 0, 1, 3, 1) # plot goes on right side, spanning 3 rows
## Display the widget as a new window
w.show()
font.setWeight(75)
self.label_4.setFont(font)
self.label_4.setObjectName("label_4")
self.horizontalLayout_2.addWidget(self.label_4)
self.lineEditRedshift = QtWidgets.QLineEdit(self.groupBox_4)
self.lineEditRedshift.setObjectName("lineEditRedshift")
self.horizontalLayout_2.addWidget(self.lineEditRedshift)
self.horizontalSliderRedshift = QtWidgets.QSlider(self.groupBox_4)
self.horizontalSliderRedshift.setMaximum(10000)
self.horizontalSliderRedshift.setOrientation(QtCore.Qt.Horizontal)
self.horizontalSliderRedshift.setObjectName("horizontalSliderRedshift")
self.horizontalLayout_2.addWidget(self.horizontalSliderRedshift)
self.horizontalLayout_2.setStretch(6, 1)
self.horizontalLayout_2.setStretch(7, 6)
self.verticalLayout_9.addLayout(self.horizontalLayout_2)
self.graphicsView_2 = PlotWidget(self.groupBox_4)
self.graphicsView_2.setObjectName("graphicsView_2")
self.verticalLayout_9.addWidget(self.graphicsView_2)
self.graphicsView = PlotWidget(self.groupBox_4)
self.graphicsView.setObjectName("graphicsView")
self.verticalLayout_9.addWidget(self.graphicsView)
self.verticalLayout_9.setStretch(2, 1)
self.verticalLayout_9.setStretch(3, 5)
self.verticalLayout_2.addWidget(self.groupBox_4)
self.verticalLayout_2.setStretch(0, 3)
self.verticalLayout_2.setStretch(1, 11)
self.horizontalLayout_3.addLayout(self.verticalLayout_2)
self.horizontalLayout_3.setStretch(0, 9)
self.horizontalLayout_3.setStretch(1, 32)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1205, 22))
def __init__(self):
super().__init__()
self.xaxis = DateAxis(orientation='bottom')
self.xaxis.setStyle(tickTextOffset=7, textFillLimits=[(0, 0.80)])
self.yaxis = PriceAxis()
self.layout = QtGui.QVBoxLayout(self)
self.layout.setContentsMargins(0, 0, 0, 0)
self.chart = pg.PlotWidget(
axisItems={'bottom': self.xaxis, 'right': self.yaxis},
enableMenu=False,
)
self.chart.setFrameStyle(QtGui.QFrame.StyledPanel | QtGui.QFrame.Plain)
self.chart.getPlotItem().setContentsMargins(*CHART_MARGINS)
self.chart.showGrid(x=True, y=True)
self.chart.hideAxis('left')
self.chart.showAxis('right')
self.chart.setCursor(QtCore.Qt.BlankCursor)
self.chart.sigXRangeChanged.connect(self._update_yrange_limits)
self.layout.addWidget(self.chart)
# Too lazy for recursion:
for child in p.children():
child.sigValueChanging.connect(valueChanging)
for ch2 in child.children():
ch2.sigValueChanging.connect(valueChanging)
#w5 = pg.ImageView()
#w5.setImage(np.random.normal(size=(100,100)))
dock5.addWidget(w5)
w6 = pg.PlotWidget(title=u"\u03b2 x,y") # beta
w6.plot([t.s for t in tws],[t.beta_x for t in tws], pen=(255, 0, 0))
w6.plot([t.s for t in tws],[t.beta_y for t in tws], pen=(0, 255, 0))
d6.addWidget(w6)
win.show()
## 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_()
self.plot_widget.block = self
self.plot_widget.setLabel('bottom', 'Frequency', units='Hz')
self.plot_widget.setLabel("left", "Time", units='s')
#TODO: listener for this
#self.plot_widget.setYRange(-self.history_size / self.sampling_rate, 0)
#self.plot_widget.setLimits(xMin=0, yMax=0)
#self.plot_widget.showButtons()
#self.waterfallPlotWidget.setAspectLocked(True)
#self.waterfallPlotWidget.setDownsampling(mode="peak")
#self.waterfallPlotWidget.setClipToView(True)
# Setup histogram widget (for controlling waterfall plot levels and gradients)
self.histogram = pg.PlotWidget(title='Histogram')
self.waterfallHistogram = pg.HistogramLUTItem()
self.histogram.addItem(self.waterfallHistogram)
self.waterfallHistogram.gradient.loadPreset("flame")
#self.waterfallHistogram.setHistogramRange(-50, 0)
#self.waterfallHistogram.setLevels(-50, 0)
self.waterfallImg = pg.ImageItem()
self.plot_widget.clear()
self.plot_widget.addItem(self.waterfallImg)
self.waterfallHistogram.setImageItem(self.waterfallImg)
self.setup_range()
self.update_counter = 0
legendArea = DockArea()
dCurve = Dock("", size=(250,600))
dInfo = Dock("", size=(250,900))
legendArea.addDock(dCurve, 'top' )
legendArea.addDock(dInfo, 'bottom')
wCur = QtGui.QWidget();
wCur.setLayout(libs.perf_reader.buildLegendLayout(path))
sCur = QtGui.QScrollArea()
sCur.setWidget(wCur)
sCur.setWidgetResizable(True)
dInfo.addWidget(sCur)
wLegend = pg.PlotWidget(title="BER preview")
wLegend.setLogMode(False, True)
wLegend.plot(x=data_snr, y=data_ber, pen=pen, name='BER plot')
wLegend.showGrid(False, False)
dCurve.addWidget(wLegend)
self.plot_lege.addTab(legendArea, 'Curve ' + str(icolor +1))
# Button for loading .dat file
load_btn = pg.QtGui.QPushButton("Load...")
w1l.addWidget(load_btn, 0, 0)
# Tree for displaying .pul structure
tree = pg.QtGui.QTreeWidget()
tree.setHeaderLabels(['Node', 'Label'])
tree.setColumnWidth(0, 200)
w1l.addWidget(tree, 1, 0)
# Tree for displaying metadata for selected node
data_tree = pg.DataTreeWidget()
vsplit.addWidget(data_tree)
# Plot for displaying trace data
plot = pg.PlotWidget()
hsplit.addWidget(plot)
# Resize and show window
hsplit.setStretchFactor(0, 400)
hsplit.setStretchFactor(1, 600)
win.resize(1200, 800)
win.show()
def load_clicked():
# Display a file dialog to select a .dat file
file_name = pg.QtGui.QFileDialog.getOpenFileName()
if file_name == '':
return
load(file_name)
def replot(self):
"""
Update plot
"""
pg.PlotWidget.update(self)
return
box, self, "component_x", callback=self._component_changed)
box = gui.vBox(axes_box, "Axis Y", margin=0)
box.setFlat(True)
self.axis_y_cb = gui.comboBox(
box, self, "component_y", callback=self._component_changed)
self.infotext = gui.widgetLabel(
gui.vBox(self.controlArea, "Contribution to Inertia"), "\n"
)
gui.auto_send(self.controlArea, self, "auto_commit")
gui.rubber(self.controlArea)
self.plot = pg.PlotWidget(background="w")
self.plot.setMenuEnabled(False)
self.mainArea.layout().addWidget(self.plot)
def addPlots(self):
"""
Initializes the GUIs plots and labels on startup.
"""
#self.objective_func_pv = "test_obj"
#setup plot 1 for obj func monitor
self.plot1 = pg.PlotWidget(title="Objective Function Monitor", labels={'left': str(self.objective_func_pv), 'bottom':"Time (seconds)"})
self.plot1.showGrid(1, 1, 1)
self.plot1.getAxis('left').enableAutoSIPrefix(enable=False) # stop the auto unit scaling on y axes
layout = QtGui.QGridLayout()
self.ui.widget_2.setLayout(layout)
layout.addWidget(self.plot1, 0, 0)
#setup plot 2 for device monitor
self.plot2 = pg.PlotWidget(title="Device Monitor", labels={'left': "Device (Current - Start)", 'bottom': "Time (seconds)"})
self.plot2.showGrid(1, 1, 1)
self.plot2.getAxis('left').enableAutoSIPrefix(enable=False) # stop the auto unit scaling on y axes
layout = QtGui.QGridLayout()
self.ui.widget_3.setLayout(layout)
layout.addWidget(self.plot2, 0, 0)
#legend for plot 2
self.leg2 = customLegend(offset=(75, 20))
self.leg2.setParentItem(self.plot2.graphicsItem())
#create the obj func line object
color = QtGui.QColor(0, 255, 255)
pen=pg.mkPen(color, width=3)
self.obj_func_line = pg.PlotCurveItem(x=[], y=[], pen=pen, antialias=True)
self.obj_func_value = pg.PlotCurveItem(x=[], y=[], pen=pg.mkPen(QtGui.QColor(255, 255, 51), width=3),
antialias=True, name="value")