File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 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+ import numpy as np
12+
13+ np .seterr (all = 'raise' )
14+
15+ from qwt .qt .QtGui import QApplication , QPen
16+ from qwt .qt .QtCore import Qt
17+ from qwt import QwtPlot , QwtPlotCurve , QwtLogScaleEngine
18+
19+
20+ def create_log_plot ():
21+ plot = QwtPlot ('LogCurveDemo.py (or how to handle -inf values)' )
22+ plot .enableAxis (QwtPlot .xBottom )
23+ plot .setAxisScaleEngine (QwtPlot .yLeft , QwtLogScaleEngine ())
24+ curve = QwtPlotCurve ()
25+ curve .setRenderHint (QwtPlotCurve .RenderAntialiased )
26+ pen = QPen (Qt .magenta )
27+ pen .setWidth (1.5 )
28+ curve .setPen (pen )
29+ curve .attach (plot )
30+ x = np .arange (0.0 , 10.0 , 0.1 )
31+ y = 10 * np .cos (x )** 2 - .1
32+ print ("y<=0:" , y <= 0 )
33+ curve .setData (x , y )
34+ plot .replot ()
35+ return plot
36+
37+
38+ if __name__ == '__main__' :
39+ app = QApplication ([])
40+ plot = create_log_plot ()
41+ plot .resize (800 , 500 )
42+ plot .show ()
43+ app .exec_ ()
You can’t perform that action at this time.
0 commit comments