File: plot_example.py

package info (click to toggle)
python-qwt 0.12.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,376 kB
  • sloc: python: 11,953; makefile: 19; sh: 10
file content (19 lines) | stat: -rw-r--r-- 597 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os.path as osp

import numpy as np
from qtpy import QtWidgets as QW

import qwt
from qwt import qthelpers as qth

app = QW.QApplication([])
x = np.linspace(-10, 10, 500)
plot = qwt.QwtPlot("Trigonometric functions")
plot.insertLegend(qwt.QwtLegend(), qwt.QwtPlot.BottomLegend)
qwt.QwtPlotCurve.make(x, np.cos(x), "Cosinus", plot, linecolor="red", antialiased=True)
qwt.QwtPlotCurve.make(x, np.sin(x), "Sinus", plot, linecolor="blue", antialiased=True)
qth.take_screenshot(
    plot,
    osp.join(osp.abspath(osp.dirname(__file__)), "_static", "QwtPlot_example.png"),
    size=(600, 300),
)