1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# -*- coding: utf-8 -*-
#
# Licensed under the terms of the Qwt License
# Copyright (c) 2002 Uwe Rathmann, for the original C++ code
# Copyright (c) 2015 Pierre Raybaut, for the Python translation/optimization
# (see LICENSE file for more details)
"""
PythonQwt
=========
The ``PythonQwt`` package is a 2D-data plotting library using Qt graphical
user interfaces for the Python programming language. It is compatible with
both ``PyQt4`` and ``PyQt5`` (``PySide`` is currently not supported but it
could be in the near future as it would "only" requires testing to support
it as a stable alternative to PyQt).
It consists of a single Python package named `qwt` which is a pure Python
implementation of Qwt C++ library with some limitations.
.. image:: images/panorama.png
External resources:
* Python Package Index: `PyPI`_
* Project page on GitHub: `GitHubPage`_
* Bug reports and feature requests: `GitHub`_
.. _PyPI: https://pypi.python.org/pypi/PythonQwt
.. _GitHubPage: http://pierreraybaut.github.io/PythonQwt
.. _GitHub: https://github.com/PierreRaybaut/PythonQwt
"""
__version__ = '0.5.5'
QWT_VERSION_STR = '6.1.2'
import warnings
from qwt.plot import QwtPlot
from qwt.symbol import QwtSymbol as QSbl # see deprecated section
from qwt.scale_engine import QwtLinearScaleEngine, QwtLogScaleEngine
from qwt.text import QwtText
from qwt.plot_canvas import QwtPlotCanvas
from qwt.plot_curve import QwtPlotCurve as QPC # see deprecated section
from qwt.plot_curve import QwtPlotItem
from qwt.scale_map import QwtScaleMap
from qwt.interval import QwtInterval
from qwt.legend import QwtLegend, QwtLegendData, QwtLegendLabel
from qwt.plot_marker import QwtPlotMarker
from qwt.plot_grid import QwtPlotGrid as QPG # see deprecated section
from qwt.color_map import QwtLinearColorMap
from qwt.toqimage import array_to_qimage as toQImage
from qwt.scale_div import QwtScaleDiv
from qwt.scale_draw import QwtScaleDraw
from qwt.scale_draw import QwtAbstractScaleDraw
from qwt.painter import QwtPainter
from qwt.plot_series import (QwtSeriesData, QwtPointArrayData, QwtSeriesStore,
QwtPlotSeriesItem)
from qwt.plot_renderer import QwtPlotRenderer
from qwt.plot_directpainter import QwtPlotDirectPainter
## ============================================================================
## Deprecated classes and attributes (to be removed in next major release)
## ============================================================================
# Remove deprecated QwtPlotItem.setAxis (replaced by setAxes)
# Remove deprecated QwtPlotCanvas.invalidatePaintCache (replaced by replot)
## ============================================================================
class QwtDoubleInterval(QwtInterval):
def __init__(self, minValue=0., maxValue=-1., borderFlags=None):
warnings.warn("`QwtDoubleInterval` has been removed in Qwt6: "\
"please use `QwtInterval` instead", RuntimeWarning)
super(QwtDoubleInterval, self).__init__(minValue, maxValue, borderFlags)
## ============================================================================
class QwtLog10ScaleEngine(QwtLogScaleEngine):
def __init__(self):
warnings.warn("`QwtLog10ScaleEngine` has been removed in Qwt6: "\
"please use `QwtLogScaleEngine` instead",
RuntimeWarning)
super(QwtLog10ScaleEngine, self).__init__(10)
## ============================================================================
class QwtPlotPrintFilter(object):
def __init__(self):
raise NotImplementedError("`QwtPlotPrintFilter` has been removed in Qwt6: "\
"please rely on `QwtPlotRenderer` instead")
## ============================================================================
class QwtPlotCurve(QPC):
@property
def Yfx(self):
raise NotImplementedError("`Yfx` attribute has been removed "\
"(curve types are no longer implemented in Qwt6)")
@property
def Xfy(self):
raise NotImplementedError("`Yfx` attribute has been removed "\
"(curve types are no longer implemented in Qwt6)")
## ============================================================================
class QwtSymbol(QSbl):
def draw(self, painter, *args):
warnings.warn("`draw` has been removed in Qwt6: "\
"please rely on `drawSymbol` and `drawSymbols` instead",
RuntimeWarning)
from qwt.qt.QtCore import QPointF
if len(args) == 2:
self.drawSymbols(painter, [QPointF(*args)])
else:
self.drawSymbol(painter, *args)
## ============================================================================
class QwtPlotGrid(QPG):
def majPen(self):
warnings.warn("`majPen` has been removed in Qwt6: "\
"please use `majorPen` instead",
RuntimeWarning)
return self.majorPen()
def minPen(self):
warnings.warn("`minPen` has been removed in Qwt6: "\
"please use `minorPen` instead",
RuntimeWarning)
return self.minorPen()
def setMajPen(self, *args):
warnings.warn("`setMajPen` has been removed in Qwt6: "\
"please use `setMajorPen` instead",
RuntimeWarning)
return self.setMajorPen(*args)
def setMinPen(self, *args):
warnings.warn("`setMinPen` has been removed in Qwt6: "\
"please use `setMinorPen` instead",
RuntimeWarning)
return self.setMinorPen(*args)
## ============================================================================