/usr/share/pyshared/guiqwt/tests/plot.py is in python-guiqwt 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guiqwt/__init__.py for details)
"""CurveDialog test"""
SHOW = True # Show test in GUI-based test launcher
from guidata.qt.QtGui import QFont
from guiqwt.plot import CurveDialog
from guiqwt.builder import make
def plot(*items):
win = CurveDialog(edit=False, toolbar=True, wintitle="CurveDialog test",
options=dict(title="Title", xlabel="xlabel",
ylabel="ylabel"))
plot = win.get_plot()
for item in items:
plot.add_item(item)
plot.set_axis_font("left", QFont("Courier"))
win.get_itemlist_panel().show()
plot.set_items_readonly(False)
win.show()
win.exec_()
def test():
"""Test"""
# -- Create QApplication
import guidata
_app = guidata.qapplication()
# --
from numpy import linspace, sin
x = linspace(-10, 10, 200)
dy = x/100.
y = sin(sin(sin(x)))
x2 = linspace(-10, 10, 20)
y2 = sin(sin(sin(x2)))
plot(make.curve(x, y, color="b"),
make.curve(x2, y2, color="g", curvestyle="Sticks"),
make.curve(x, sin(2*y), color="r"),
make.merror(x, y/2, dy),
make.label("Relative position <b>outside</b>",
(x[0], y[0]), (-10, -10), "BR"),
make.label("Relative position <i>inside</i>",
(x[0], y[0]), (10, 10), "TL"),
make.label("Absolute position", "R", (0, 0), "R"),
make.legend("TR"),
make.marker(position=(5., .8), label_cb=lambda x, y: "A = %.2f" % x,
markerstyle="|", movable=False)
)
if __name__ == "__main__":
test()
|