def divideScale(self, x1, x2, maxMajorSteps, maxMinorSteps, stepSize=0.0): """ Calculate a scale division for an interval :param float x1: First interval limit :param float x2: Second interval limit :param int maxMajorSteps: Maximum for the number of major steps :param int maxMinorSteps: Maximum number of minor steps :param float stepSize: Step size. If stepSize == 0.0, the scaleEngine calculates one :return: Calculated scale division """ interval = QwtInterval(x1, x2).normalized() if interval.width() <= 0: return QwtScaleDiv() stepSize = abs(stepSize) if stepSize == 0.0: if maxMajorSteps < 1: maxMajorSteps = 1 stepSize = divideInterval(interval.width(), maxMajorSteps, self.base()) scaleDiv = QwtScaleDiv() if stepSize != 0.0: ticks = self.buildTicks(interval, stepSize, maxMinorSteps) scaleDiv = QwtScaleDiv(interval, ticks) if x1 > x2: scaleDiv.invert() return scaleDiv
def divideScale(self, x1, x2, maxMajorSteps, maxMinorSteps, stepSize=0.): """ Calculate a scale division for an interval :param float x1: First interval limit :param float x2: Second interval limit :param int maxMajorSteps: Maximum for the number of major steps :param int maxMinorSteps: Maximum number of minor steps :param float stepSize: Step size. If stepSize == 0.0, the scaleEngine calculates one :return: Calculated scale division """ interval = QwtInterval(x1, x2).normalized() if interval.width() <= 0: return QwtScaleDiv() stepSize = abs(stepSize) if stepSize == 0.: if maxMajorSteps < 1: maxMajorSteps = 1 stepSize = divideInterval(interval.width(), maxMajorSteps, self.base()) scaleDiv = QwtScaleDiv() if stepSize != 0.: ticks = self.buildTicks(interval, stepSize, maxMinorSteps) scaleDiv = QwtScaleDiv(interval, ticks) if x1 > x2: scaleDiv.invert() return scaleDiv
def divideScale(self, x1, x2, maxMajorSteps, maxMinorSteps, stepSize=0.): """ Calculate a scale division for an interval :param float x1: First interval limit :param float x2: Second interval limit :param int maxMajorSteps: Maximum for the number of major steps :param int maxMinorSteps: Maximum number of minor steps :param float stepSize: Step size. If stepSize == 0.0, the scaleEngine calculates one :return: Calculated scale division """ interval = QwtInterval(x1, x2).normalized() interval = interval.limited(LOG_MIN, LOG_MAX) if interval.width() <= 0: return QwtScaleDiv() logBase = self.base() if interval.maxValue()/interval.minValue() < logBase: linearScaler = QwtLinearScaleEngine() linearScaler.setAttributes(self.attributes()) linearScaler.setReference(self.reference()) linearScaler.setMargins(self.lowerMargin(), self.upperMargin()) if stepSize != 0.: if stepSize < 0.: stepSize = -np.power(logBase, -stepSize) else: stepSize = np.power(logBase, stepSize) return linearScaler.divideScale(x1, x2, maxMajorSteps, maxMinorSteps, stepSize) stepSize = abs(stepSize) if stepSize == 0.: if maxMajorSteps < 1: maxMajorSteps = 1 stepSize = self.divideInterval( qwtLogInterval(logBase, interval).width(), maxMajorSteps) if stepSize < 1.: stepSize = 1. scaleDiv = QwtScaleDiv() if stepSize != 0.: ticks = self.buildTicks(interval, stepSize, maxMinorSteps) scaleDiv = QwtScaleDiv(interval, ticks) if x1 > x2: scaleDiv.invert() return scaleDiv
def divideScale(self, x1, x2, maxMajorSteps, maxMinorSteps, stepSize=0.): interval = QwtInterval(x1, x2).normalized() if interval.width() <= 0: return QwtScaleDiv() stepSize = abs(stepSize) if stepSize == 0.: if maxMajorSteps < 1: maxMajorSteps = 1 stepSize = divideInterval(interval.width(), maxMajorSteps, self.base()) scaleDiv = QwtScaleDiv() if stepSize != 0.: ticks = self.buildTicks(interval, stepSize, maxMinorSteps) scaleDiv = QwtScaleDiv(interval, ticks) if x1 > x2: scaleDiv.invert() return scaleDiv
def divideScale(self, x1, x2, maxMajorSteps, maxMinorSteps, stepSize=0.): interval = QwtInterval(x1, x2).normalized() interval = interval.limited(LOG_MIN, LOG_MAX) if interval.width() <= 0: return QwtScaleDiv() logBase = self.base() if interval.maxValue()/interval.minValue() < logBase: linearScaler = QwtLinearScaleEngine() linearScaler.setAttributes(self.attributes()) linearScaler.setReference(self.reference()) linearScaler.setMargins(self.lowerMargin(), self.upperMargin()) if stepSize != 0.: if stepSize < 0.: stepSize = -np.power(logBase, -stepSize) else: stepSize = np.power(logBase, stepSize) return linearScaler.divideScale(x1, x2, maxMajorSteps, maxMinorSteps, stepSize) stepSize = abs(stepSize) if stepSize == 0.: if maxMajorSteps < 1: maxMajorSteps = 1 stepSize = self.divideInterval( qwtLogInterval(logBase, interval).width(), maxMajorSteps) if stepSize < 1.: stepSize = 1. scaleDiv = QwtScaleDiv() if stepSize != 0.: ticks = self.buildTicks(interval, stepSize, maxMinorSteps) scaleDiv = QwtScaleDiv(interval, ticks) if x1 > x2: scaleDiv.invert() return scaleDiv
def divideScale(self, x1, x2, maxMajorSteps, maxMinorSteps, stepSize=0.): interval = QwtInterval(x1, x2).normalized() interval = interval.limited(LOG_MIN, LOG_MAX) if interval.width() <= 0: return QwtScaleDiv() logBase = self.base() if interval.maxValue() / interval.minValue() < logBase: linearScaler = QwtLinearScaleEngine() linearScaler.setAttributes(self.attributes()) linearScaler.setReference(self.reference()) linearScaler.setMargins(self.lowerMargin(), self.upperMargin()) if stepSize != 0.: if stepSize < 0.: stepSize = -np.power(logBase, -stepSize) else: stepSize = np.power(logBase, stepSize) return linearScaler.divideScale(x1, x2, maxMajorSteps, maxMinorSteps, stepSize) stepSize = abs(stepSize) if stepSize == 0.: if maxMajorSteps < 1: maxMajorSteps = 1 stepSize = self.divideInterval( qwtLogInterval(logBase, interval).width(), maxMajorSteps) if stepSize < 1.: stepSize = 1. scaleDiv = QwtScaleDiv() if stepSize != 0.: ticks = self.buildTicks(interval, stepSize, maxMinorSteps) scaleDiv = QwtScaleDiv(interval, ticks) if x1 > x2: scaleDiv.invert() return scaleDiv