PythonQwt 0.14.1__tar.gz → 0.14.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. {pythonqwt-0.14.1/PythonQwt.egg-info → pythonqwt-0.14.3}/PKG-INFO +6 -4
  2. {pythonqwt-0.14.1 → pythonqwt-0.14.3/PythonQwt.egg-info}/PKG-INFO +6 -4
  3. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/PythonQwt.egg-info/SOURCES.txt +1 -0
  4. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/README.md +4 -2
  5. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/__init__.py +1 -1
  6. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/interval.py +0 -15
  7. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/plot.py +13 -37
  8. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/scale_engine.py +27 -10
  9. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_curvebenchmark1.py +4 -1
  10. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_loadtest.py +5 -0
  11. pythonqwt-0.14.3/qwt/tests/test_relativemargin.py +54 -0
  12. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/LICENSE +0 -0
  13. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/MANIFEST.in +0 -0
  14. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/PythonQwt-tests.desktop +0 -0
  15. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/PythonQwt.egg-info/dependency_links.txt +0 -0
  16. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/PythonQwt.egg-info/entry_points.txt +0 -0
  17. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/PythonQwt.egg-info/requires.txt +0 -0
  18. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/PythonQwt.egg-info/top_level.txt +0 -0
  19. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/_static/PythonQwt_logo.png +0 -0
  20. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/_static/QwtPlot_example.png +0 -0
  21. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/_static/panorama.png +0 -0
  22. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/_static/symbol_path_example.png +0 -0
  23. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/conf.py +0 -0
  24. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/bodedemo.rst +0 -0
  25. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/cartesian.rst +0 -0
  26. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/cpudemo.rst +0 -0
  27. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/curvebenchmark1.rst +0 -0
  28. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/curvebenchmark2.rst +0 -0
  29. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/curvedemo1.rst +0 -0
  30. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/curvedemo2.rst +0 -0
  31. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/data.rst +0 -0
  32. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/errorbar.rst +0 -0
  33. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/eventfilter.rst +0 -0
  34. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/image.rst +0 -0
  35. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/index.rst +0 -0
  36. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/logcurve.rst +0 -0
  37. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/mapdemo.rst +0 -0
  38. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/multidemo.rst +0 -0
  39. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/simple.rst +0 -0
  40. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/examples/vertical.rst +0 -0
  41. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/index.rst +0 -0
  42. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/installation.rst +0 -0
  43. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/overview.rst +0 -0
  44. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/plot_example.py +0 -0
  45. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/graphic.rst +0 -0
  46. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/index.rst +0 -0
  47. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/interval.rst +0 -0
  48. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/plot.rst +0 -0
  49. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/plot_directpainter.rst +0 -0
  50. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/plot_layout.rst +0 -0
  51. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/plot_series.rst +0 -0
  52. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/scale.rst +0 -0
  53. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/symbol.rst +0 -0
  54. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/text.rst +0 -0
  55. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/toqimage.rst +0 -0
  56. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/reference/transform.rst +0 -0
  57. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/requirements.txt +0 -0
  58. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/doc/symbol_path_example.py +0 -0
  59. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/pyproject.toml +0 -0
  60. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/_math.py +0 -0
  61. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/color_map.py +0 -0
  62. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/column_symbol.py +0 -0
  63. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/dyngrid_layout.py +0 -0
  64. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/graphic.py +0 -0
  65. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/legend.py +0 -0
  66. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/null_paintdevice.py +0 -0
  67. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/painter.py +0 -0
  68. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/painter_command.py +0 -0
  69. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/plot_canvas.py +0 -0
  70. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/plot_curve.py +0 -0
  71. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/plot_directpainter.py +0 -0
  72. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/plot_grid.py +0 -0
  73. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/plot_layout.py +0 -0
  74. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/plot_marker.py +0 -0
  75. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/plot_renderer.py +0 -0
  76. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/plot_series.py +0 -0
  77. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/qthelpers.py +0 -0
  78. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/scale_div.py +0 -0
  79. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/scale_draw.py +0 -0
  80. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/scale_map.py +0 -0
  81. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/scale_widget.py +0 -0
  82. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/symbol.py +0 -0
  83. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/__init__.py +0 -0
  84. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/comparative_benchmarks.py +0 -0
  85. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/conftest.py +0 -0
  86. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/PythonQwt.svg +0 -0
  87. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/bodedemo.png +0 -0
  88. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/cartesian.png +0 -0
  89. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/cpudemo.png +0 -0
  90. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/curvebenchmark1.png +0 -0
  91. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/curvebenchmark2.png +0 -0
  92. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/curvedemo1.png +0 -0
  93. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/curvedemo2.png +0 -0
  94. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/data.png +0 -0
  95. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/errorbar.png +0 -0
  96. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/eventfilter.png +0 -0
  97. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/image.png +0 -0
  98. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/loadtest.png +0 -0
  99. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/logcurve.png +0 -0
  100. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/mapdemo.png +0 -0
  101. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/multidemo.png +0 -0
  102. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/simple.png +0 -0
  103. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/stylesheet.png +0 -0
  104. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/symbol.svg +0 -0
  105. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/symbols.png +0 -0
  106. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/testlauncher.png +0 -0
  107. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/data/vertical.png +0 -0
  108. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_backingstore.py +0 -0
  109. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_bodedemo.py +0 -0
  110. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_cartesian.py +0 -0
  111. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_cpudemo.py +0 -0
  112. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_curvebenchmark2.py +0 -0
  113. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_curvedemo1.py +0 -0
  114. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_curvedemo2.py +0 -0
  115. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_data.py +0 -0
  116. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_errorbar.py +0 -0
  117. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_eventfilter.py +0 -0
  118. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_highdpi.py +0 -0
  119. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_image.py +0 -0
  120. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_logcurve.py +0 -0
  121. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_mapdemo.py +0 -0
  122. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_multidemo.py +0 -0
  123. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_simple.py +0 -0
  124. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_stylesheet.py +0 -0
  125. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_symbols.py +0 -0
  126. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/test_vertical.py +0 -0
  127. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/tests/utils.py +0 -0
  128. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/text.py +0 -0
  129. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/toqimage.py +0 -0
  130. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/qwt/transform.py +0 -0
  131. {pythonqwt-0.14.1 → pythonqwt-0.14.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: PythonQwt
3
- Version: 0.14.1
3
+ Version: 0.14.3
4
4
  Summary: Qt plotting widgets for Python
5
5
  Author-email: Pierre Raybaut <pierre.raybaut@gmail.com>
6
6
  License: PythonQwt License Agreement
@@ -722,10 +722,12 @@ See documentation [online](https://pythonqwt.readthedocs.io/en/latest/) or [PDF]
722
722
  ## Sample
723
723
 
724
724
  ```python
725
- import qwt
726
725
  import numpy as np
726
+ from qtpy import QtWidgets as QW
727
+
728
+ import qwt
727
729
 
728
- app = qwt.qt.QtGui.QApplication([])
730
+ app = QW.QApplication([])
729
731
 
730
732
  # Create plot widget
731
733
  plot = qwt.QwtPlot("Trigonometric functions")
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: PythonQwt
3
- Version: 0.14.1
3
+ Version: 0.14.3
4
4
  Summary: Qt plotting widgets for Python
5
5
  Author-email: Pierre Raybaut <pierre.raybaut@gmail.com>
6
6
  License: PythonQwt License Agreement
@@ -722,10 +722,12 @@ See documentation [online](https://pythonqwt.readthedocs.io/en/latest/) or [PDF]
722
722
  ## Sample
723
723
 
724
724
  ```python
725
- import qwt
726
725
  import numpy as np
726
+ from qtpy import QtWidgets as QW
727
+
728
+ import qwt
727
729
 
728
- app = qwt.qt.QtGui.QApplication([])
730
+ app = QW.QApplication([])
729
731
 
730
732
  # Create plot widget
731
733
  plot = qwt.QwtPlot("Trigonometric functions")
@@ -99,6 +99,7 @@ qwt/tests/test_loadtest.py
99
99
  qwt/tests/test_logcurve.py
100
100
  qwt/tests/test_mapdemo.py
101
101
  qwt/tests/test_multidemo.py
102
+ qwt/tests/test_relativemargin.py
102
103
  qwt/tests/test_simple.py
103
104
  qwt/tests/test_stylesheet.py
104
105
  qwt/tests/test_symbols.py
@@ -20,10 +20,12 @@ See documentation [online](https://pythonqwt.readthedocs.io/en/latest/) or [PDF]
20
20
  ## Sample
21
21
 
22
22
  ```python
23
- import qwt
24
23
  import numpy as np
24
+ from qtpy import QtWidgets as QW
25
+
26
+ import qwt
25
27
 
26
- app = qwt.qt.QtGui.QApplication([])
28
+ app = QW.QApplication([])
27
29
 
28
30
  # Create plot widget
29
31
  plot = qwt.QwtPlot("Trigonometric functions")
@@ -55,7 +55,7 @@ from qwt.symbol import QwtSymbol as QSbl # see deprecated section
55
55
  from qwt.text import QwtText # noqa: F401
56
56
  from qwt.toqimage import array_to_qimage as toQImage # noqa: F401
57
57
 
58
- __version__ = "0.14.1"
58
+ __version__ = "0.14.3"
59
59
  QWT_VERSION_STR = "6.1.5"
60
60
 
61
61
 
@@ -396,18 +396,3 @@ class QwtInterval(object):
396
396
  if not self.isValid():
397
397
  return self
398
398
  return QwtInterval(min([value, self.__minValue]), max([value, self.__maxValue]))
399
-
400
- def extend_fraction(self, value):
401
- """
402
- Extend the interval by a fraction of its width
403
-
404
- :param float value: Fraction
405
- :return: extended interval
406
- """
407
- if not self.isValid():
408
- return self
409
- return QwtInterval(
410
- self.__minValue - value * self.width(),
411
- self.__maxValue + value * self.width(),
412
- self.__borderFlags,
413
- )
@@ -588,7 +588,7 @@ class QwtPlot(QFrame):
588
588
  def axisMargin(self, axisId):
589
589
  """
590
590
  :param int axisId: Axis index
591
- :return: Margin in % of the canvas size
591
+ :return: Relative margin of the axis, as a fraction of the full axis range
592
592
 
593
593
  .. seealso::
594
594
 
@@ -871,15 +871,17 @@ class QwtPlot(QFrame):
871
871
 
872
872
  def setAxisMargin(self, axisId, margin):
873
873
  """
874
- Set the margin of the scale widget
874
+ Set the relative margin of the axis, as a fraction of the full axis range
875
875
 
876
876
  :param int axisId: Axis index
877
- :param float margin: Margin in % of the canvas size
877
+ :param float margin: Relative margin (float between 0 and 1)
878
878
 
879
879
  .. seealso::
880
880
 
881
881
  :py:meth:`axisMargin()`
882
882
  """
883
+ if not isinstance(margin, float) or margin < 0.0 or margin > 1.0:
884
+ raise ValueError("margin must be a float between 0 and 1")
883
885
  if self.axisValid(axisId):
884
886
  d = self.__axisData[axisId]
885
887
  if margin != d.margin:
@@ -946,15 +948,13 @@ class QwtPlot(QFrame):
946
948
  minValue = d.minValue
947
949
  maxValue = d.maxValue
948
950
  stepSize = d.stepSize
949
- if d.margin is not None:
950
- intv_i = intv[axisId].extend_fraction(d.margin)
951
- else:
952
- intv_i = intv[axisId]
953
- if d.doAutoScale and intv_i.isValid():
951
+ if d.doAutoScale and intv[axisId].isValid():
954
952
  d.isValid = False
955
- minValue = intv_i.minValue()
956
- maxValue = intv_i.maxValue()
957
- d.scaleEngine.autoScale(d.maxMajor, minValue, maxValue, stepSize)
953
+ minValue = intv[axisId].minValue()
954
+ maxValue = intv[axisId].maxValue()
955
+ minValue, maxValue, stepSize = d.scaleEngine.autoScale(
956
+ d.maxMajor, minValue, maxValue, stepSize, d.margin
957
+ )
958
958
  if not d.isValid:
959
959
  d.scaleDiv = d.scaleEngine.divideScale(
960
960
  minValue, maxValue, d.maxMajor, d.maxMinor, stepSize
@@ -1560,9 +1560,9 @@ class QwtPlot(QFrame):
1560
1560
  if self.__data.legend.parent() is not self:
1561
1561
  self.__data.legend.setParent(self)
1562
1562
 
1563
- self.blockSignals(True)
1563
+ self.legendDataChanged.disconnect(self.updateLegendItems)
1564
1564
  self.updateLegend()
1565
- self.blockSignals(False)
1565
+ self.legendDataChanged.connect(self.updateLegendItems)
1566
1566
 
1567
1567
  lpos = self.__data.layout.legendPosition()
1568
1568
 
@@ -1706,7 +1706,6 @@ class QwtPlotItem_PrivateData(QObject):
1706
1706
  self.yAxis = QwtPlot.yLeft
1707
1707
  self.legendIconSize = QSize(8, 8)
1708
1708
  self.title = None # QwtText
1709
- self.icon = None
1710
1709
 
1711
1710
 
1712
1711
  class QwtPlotItem(object):
@@ -1915,29 +1914,6 @@ class QwtPlotItem(object):
1915
1914
  """
1916
1915
  return self.__data.title
1917
1916
 
1918
- def setIcon(self, icon):
1919
- """
1920
- Set item icon
1921
-
1922
- :param icon: Icon
1923
- :type icon: QIcon
1924
-
1925
- .. seealso::
1926
-
1927
- :py:meth:`icon()`
1928
- """
1929
- self.__data.icon = icon
1930
-
1931
- def icon(self):
1932
- """
1933
- :return: Icon of the item
1934
-
1935
- .. seealso::
1936
-
1937
- :py:meth:`setIcon()`
1938
- """
1939
- return self.__data.icon
1940
-
1941
1917
  def setItemAttribute(self, attribute, on=True):
1942
1918
  """
1943
1919
  Toggle an item attribute
@@ -37,8 +37,8 @@ from qwt.scale_div import QwtScaleDiv
37
37
  from qwt.transform import QwtLogTransform, QwtTransform
38
38
 
39
39
  DBL_MAX = sys.float_info.max
40
- LOG_MIN = 1.0e-100
41
- LOG_MAX = 1.0e100
40
+ LOG_MIN = 1.0e-150
41
+ LOG_MAX = 1.0e150
42
42
 
43
43
 
44
44
  def qwtLogInterval(base, interval):
@@ -198,7 +198,7 @@ class QwtScaleEngine(object):
198
198
  self.__data = QwtScaleEngine_PrivateData()
199
199
  self.setBase(base)
200
200
 
201
- def autoScale(self, maxNumSteps, x1, x2, stepSize):
201
+ def autoScale(self, maxNumSteps, x1, x2, stepSize, relative_margin=0.0):
202
202
  """
203
203
  Align and divide an interval
204
204
 
@@ -206,6 +206,7 @@ class QwtScaleEngine(object):
206
206
  :param float x1: First limit of the interval (In/Out)
207
207
  :param float x2: Second limit of the interval (In/Out)
208
208
  :param float stepSize: Step size
209
+ :param float relative_margin: Margin as a fraction of the interval width
209
210
  :return: tuple (x1, x2, stepSize)
210
211
  """
211
212
  pass
@@ -473,7 +474,7 @@ class QwtLinearScaleEngine(QwtScaleEngine):
473
474
  def __init__(self, base=10):
474
475
  super(QwtLinearScaleEngine, self).__init__(base)
475
476
 
476
- def autoScale(self, maxNumSteps, x1, x2, stepSize):
477
+ def autoScale(self, maxNumSteps, x1, x2, stepSize, relative_margin=0.0):
477
478
  """
478
479
  Align and divide an interval
479
480
 
@@ -481,12 +482,19 @@ class QwtLinearScaleEngine(QwtScaleEngine):
481
482
  :param float x1: First limit of the interval (In/Out)
482
483
  :param float x2: Second limit of the interval (In/Out)
483
484
  :param float stepSize: Step size
485
+ :param float relative_margin: Margin as a fraction of the interval width
484
486
  :return: tuple (x1, x2, stepSize)
485
487
 
486
488
  .. seealso::
487
489
 
488
490
  :py:meth:`setAttribute()`
489
491
  """
492
+ # Apply the relative margin (fraction of the interval width) in linear space:
493
+ if relative_margin > 0.0:
494
+ margin = (x2 - x1) * relative_margin
495
+ x1 -= margin
496
+ x2 += margin
497
+
490
498
  interval = QwtInterval(x1, x2)
491
499
  interval = interval.normalized()
492
500
  interval.setMinValue(interval.minValue() - self.lowerMargin())
@@ -640,7 +648,7 @@ class QwtLogScaleEngine(QwtScaleEngine):
640
648
  super(QwtLogScaleEngine, self).__init__(base)
641
649
  self.setTransformation(QwtLogTransform())
642
650
 
643
- def autoScale(self, maxNumSteps, x1, x2, stepSize):
651
+ def autoScale(self, maxNumSteps, x1, x2, stepSize, relative_margin=0.0):
644
652
  """
645
653
  Align and divide an interval
646
654
 
@@ -648,6 +656,7 @@ class QwtLogScaleEngine(QwtScaleEngine):
648
656
  :param float x1: First limit of the interval (In/Out)
649
657
  :param float x2: Second limit of the interval (In/Out)
650
658
  :param float stepSize: Step size
659
+ :param float relative_margin: Margin as a fraction of the interval width
651
660
  :return: tuple (x1, x2, stepSize)
652
661
 
653
662
  .. seealso::
@@ -657,11 +666,20 @@ class QwtLogScaleEngine(QwtScaleEngine):
657
666
  if x1 > x2:
658
667
  x1, x2 = x2, x1
659
668
  logBase = self.base()
669
+
670
+ # Apply the relative margin (fraction of the interval width) in logarithmic
671
+ # space, and convert back to linear space.
672
+ if relative_margin is not None:
673
+ x1 = min(max([x1, LOG_MIN]), LOG_MAX)
674
+ x2 = min(max([x2, LOG_MIN]), LOG_MAX)
675
+ log_margin = math.log(x2 / x1, logBase) * relative_margin
676
+ x1 /= math.pow(logBase, log_margin)
677
+ x2 *= math.pow(logBase, log_margin)
678
+
660
679
  interval = QwtInterval(
661
680
  x1 / math.pow(logBase, self.lowerMargin()),
662
681
  x2 * math.pow(logBase, self.upperMargin()),
663
682
  )
664
- interval = interval.limited(LOG_MIN, LOG_MAX)
665
683
  if interval.maxValue() / interval.minValue() < logBase:
666
684
  linearScaler = QwtLinearScaleEngine()
667
685
  linearScaler.setAttributes(self.attributes())
@@ -674,10 +692,9 @@ class QwtLogScaleEngine(QwtScaleEngine):
674
692
  linearInterval = linearInterval.limited(LOG_MIN, LOG_MAX)
675
693
 
676
694
  if linearInterval.maxValue() / linearInterval.minValue() < logBase:
677
- if stepSize < 0.0:
678
- stepSize = -math.log(abs(stepSize), logBase)
679
- else:
680
- stepSize = math.log(stepSize, logBase)
695
+ # The min / max interval is too short to be represented as a log scale.
696
+ # Set the step to 0, so that a new step is calculated and a linear scale is used.
697
+ stepSize = 0.0
681
698
  return x1, x2, stepSize
682
699
 
683
700
  logRef = 1.0
@@ -142,6 +142,7 @@ class CurveBenchmark1(QMainWindow):
142
142
  self.text = BMText(self)
143
143
  self.tabs.addTab(self.text, "Contents")
144
144
  self.resize(*self.SIZE)
145
+ self.durations = []
145
146
 
146
147
  # Force window to show up and refresh (for test purpose only)
147
148
  self.show()
@@ -160,7 +161,9 @@ class CurveBenchmark1(QMainWindow):
160
161
  # Force widget to refresh (for test purpose only)
161
162
  QApplication.processEvents()
162
163
 
163
- time_str = "Elapsed time: %d ms" % ((time.time() - t0) * 1000)
164
+ duration = (time.time() - t0) * 1000
165
+ self.durations.append(duration)
166
+ time_str = "Elapsed time: %d ms" % duration
164
167
  widget.text.setText(time_str)
165
168
  self.text.append("<br><i>%s:</i><br>%s" % (description, time_str))
166
169
  print("[%s] %s" % (utils.get_lib_versions(), time_str))
@@ -10,6 +10,8 @@ SHOW = True # Show test in GUI-based test launcher
10
10
 
11
11
  import time
12
12
 
13
+ import numpy as np
14
+
13
15
  # Local imports
14
16
  from qwt.tests import test_curvebenchmark1 as cb
15
17
  from qwt.tests import utils
@@ -47,6 +49,9 @@ class LoadTest(cb.CurveBenchmark1):
47
49
  symtext,
48
50
  )
49
51
  self.process_iteration(title, description, widget, t0)
52
+ print("")
53
+ time_str = "Average elapsed time: %d ms" % np.mean(self.durations)
54
+ print("[%s] %s" % (utils.get_lib_versions(), time_str))
50
55
 
51
56
 
52
57
  def test_loadtest():
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Licensed under the terms of the PyQwt License
4
+ # Copyright (C) 2003-2009 Gerard Vermeulen, for the original PyQwt example
5
+ # Copyright (c) 2015 Pierre Raybaut, for the PyQt5/PySide port and further
6
+ # developments (e.g. ported to PythonQwt API)
7
+ # (see LICENSE file for more details)
8
+
9
+ SHOW = True # Show test in GUI-based test launcher
10
+
11
+ from qtpy import QtWidgets as QW
12
+ from qtpy.QtCore import Qt
13
+
14
+ import qwt
15
+ from qwt.tests import utils
16
+
17
+
18
+ class RelativeMarginDemo(QW.QWidget):
19
+ def __init__(self, *args):
20
+ QW.QWidget.__init__(self, *args)
21
+ layout = QW.QGridLayout(self)
22
+ x = [1, 2, 3, 4]
23
+ y = [1, 500, 1000, 1500]
24
+ for i_row, log_scale in enumerate((False, True)):
25
+ for i_col, relative_margin in enumerate((0.0, None, 0.2)):
26
+ plot = qwt.QwtPlot(self)
27
+ qwt.QwtPlotGrid.make(
28
+ plot, color=Qt.lightGray, width=0, style=Qt.DotLine
29
+ )
30
+ def_margin = plot.axisMargin(qwt.QwtPlot.yLeft)
31
+ scale_str = "lin/lin" if not log_scale else "log/lin"
32
+ if relative_margin is None:
33
+ margin_str = f"default ({def_margin*100:.0f}%)"
34
+ else:
35
+ margin_str = f"{relative_margin*100:.0f}%"
36
+ plot.setTitle(f"{scale_str}, margin: {margin_str}")
37
+ if relative_margin is not None:
38
+ plot.setAxisMargin(qwt.QwtPlot.yLeft, relative_margin)
39
+ plot.setAxisMargin(qwt.QwtPlot.xBottom, relative_margin)
40
+ color = "red" if i_row == 0 else "blue"
41
+ qwt.QwtPlotCurve.make(x, y, "", plot, linecolor=color)
42
+ layout.addWidget(plot, i_row, i_col)
43
+ if log_scale:
44
+ engine = qwt.QwtLogScaleEngine()
45
+ plot.setAxisScaleEngine(qwt.QwtPlot.yLeft, engine)
46
+
47
+
48
+ def test_relative_margin():
49
+ """Test relative margin."""
50
+ utils.test_widget(RelativeMarginDemo, size=(400, 300), options=False)
51
+
52
+
53
+ if __name__ == "__main__":
54
+ test_relative_margin()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes