Commit d472e1e9 authored by Ivo Peterek's avatar Ivo Peterek

ENH: dot size in scatter plot may be changed by user. #8

parent 7d28e5e2
......@@ -220,11 +220,22 @@ class Window(QtWidgets.QDialog):
layout.addWidget(self.toolbar)
layout.addWidget(self.canvas)
labelDotsize = QtWidgets.QLabel("Dot size: ")
labelDotsize.setFixedWidth(60)
self.dotSizeSpinBox = QtWidgets.QSpinBox()
self.dotSizeSpinBox.setFixedWidth(100)
self.dotSizeSpinBox.setMinimum(1)
self.dotSizeSpinBox.setMaximum(2147483647)
self.dotSizeSpinBox.valueChanged.connect(self.dotSizeChanged)
self.dotSizeSpinBox.setEnabled(False)
hlayout = QtWidgets.QHBoxLayout()
#hlayout.addWidget(self.checkbox_sw)
#hlayout.addWidget(self.maxBox)
hlayout.addWidget(self.logscaleX)
hlayout.addWidget(self.logscaleY)
hlayout.addWidget(labelDotsize)
hlayout.addWidget(self.dotSizeSpinBox)
hlayout.addWidget(self.typeButton)
layout.addLayout(hlayout)
......@@ -237,13 +248,17 @@ class Window(QtWidgets.QDialog):
# self.plot()
self.resize(800,800)
def dotSizeChanged(self):
self.plot()
def changeType(self):
self.plotType = not self.plotType
if self.plotType:
self.typeButton.setText('Line plot')
self.dotSizeSpinBox.setEnabled(True)
else:
self.typeButton.setText('Scatter plot')
self.dotSizeSpinBox.setEnabled(False)
self.plot()
def clearCanvas(self):
......@@ -559,12 +574,12 @@ class Window(QtWidgets.QDialog):
if self.sw:
if self.plotType:
self.ax.plot(Y, X, 'o', label=self.k[m], color=colors[m])
self.ax.scatter(Y, X, label=self.k[m], color=colors[m], s=self.dotSizeSpinBox.value())
else:
self.ax.plot(Y, X, label=self.k[m], color=colors[m])
else:
if self.plotType:
self.ax.plot(X, Y, 'o', label=self.k[m], color=colors[m])
self.ax.scatter(X, Y, label=self.k[m], color=colors[m], s=self.dotSizeSpinBox.value())
else:
self.ax.plot(X, Y, label=self.k[m], color=colors[m])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment