subclass every PlotWidget because logtickvalues
This commit is contained in:
@ -106,10 +106,6 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
self.plotItem.ctrl.logXCheck.blockSignals(True)
|
||||
self.plotItem.ctrl.logYCheck.blockSignals(True)
|
||||
|
||||
for orient in ['top', 'bottom', 'left', 'right']:
|
||||
# BAD HACK!!! but seems to work, see function for explanation
|
||||
self.plotItem.getAxis(orient).logTickValues = logTickValues
|
||||
|
||||
for lineedit in [self.xmin_lineedit, self.xmax_lineedit, self.ymin_lineedit, self.ymax_lineedit]:
|
||||
lineedit.setValidator(QtGui.QDoubleValidator())
|
||||
|
||||
@ -163,6 +159,10 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
def active(self) -> list:
|
||||
return [set_id for set_id in self.sets if set_id in self._active]
|
||||
|
||||
@active.setter
|
||||
def active(self, value: list):
|
||||
self._active = value
|
||||
|
||||
def block(self, state: bool):
|
||||
self._block = state
|
||||
|
||||
@ -779,30 +779,3 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
||||
self.set_color(foreground=self._prev_colors[0], background=self._prev_colors[1])
|
||||
self._prev_colors = temp
|
||||
|
||||
|
||||
def logTickValues(minVal, maxVal, size, stdTicks):
|
||||
# TODO FIND A BETTER SOLUTION!!!
|
||||
# Sometimes minVal and maxVal are not log-scaled values and the loop from v1 to v2 is humongous,
|
||||
# The minor list then fills the RAM completely and freezes everything
|
||||
# Until there is a better solution, we overwrite this function for every AxesItem
|
||||
# and do not draw minor ticks at all if there are too many
|
||||
|
||||
# start with the tick spacing given by tickValues().
|
||||
# Any level whose spacing is < 1 needs to be converted to log scale
|
||||
ticks = []
|
||||
for (spacing, t) in stdTicks:
|
||||
if spacing >= 1.0:
|
||||
ticks.append((spacing, t))
|
||||
|
||||
if len(ticks) < 3:
|
||||
v1 = int(np.floor(minVal))
|
||||
v2 = int(np.ceil(maxVal))
|
||||
# major = list(range(v1+1, v2))
|
||||
minor = []
|
||||
|
||||
if v2 - v1 < 400:
|
||||
for v in range(v1, v2):
|
||||
minor.extend(v + np.log10(np.arange(1, 10)))
|
||||
minor = [x for x in minor if x>minVal and x<maxVal]
|
||||
ticks.append((None, minor))
|
||||
return ticks
|
||||
|
Reference in New Issue
Block a user