/usr/share/pyshared/guiqwt/tests/pyplot.py is in python-guiqwt 2.1.6-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 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 | # -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guiqwt/__init__.py for details)
"""
pyplot test
Interactive plotting interface with MATLAB-like syntax
"""
SHOW = True # Show test in GUI-based test launcher
import numpy as np
from guiqwt.pyplot import *
def main():
x = np.linspace(-5, 5, 1000)
figure(1)
subplot(2, 1, 1)
plot(x, np.sin(x), "r+")
plot(x, np.cos(x), "g-")
errorbar(x, -1+x**2/20+.2*np.random.rand(len(x)), x/20)
xlabel("Axe x")
ylabel("Axe y")
subplot(2, 1, 2)
img = np.fromfunction(lambda x, y:
np.sin((x/200.)*(y/200.)**2), (1000, 1000))
xlabel("pixels")
ylabel("pixels")
zlabel("intensity")
gray()
imshow(img)
# savefig("D:\\test1.pdf", draft=True)
figure("table plot")
data = np.array([x, np.sin(x), np.cos(x)]).T
plot(data)
figure("simple plot")
subplot(1, 2, 1)
plot(x, np.tanh(x+np.sin(12*x)), "g-", label="Tanh")
legend()
subplot(1, 2, 2)
plot(x, np.sinh(x), "r:", label="SinH")
# savefig("D:\\test2.pdf")
# savefig("D:\\test2.png")
show()
figure("semilogx")
semilogx(x, np.sin(12*x), "g-")
show()
figure("plotyy")
plotyy(x, np.sin(x), x, np.cos(x))
ylabel("sinus", "cosinus")
show()
figure("hist")
from numpy.random import normal
data = normal(0, 1, (2000, ))
hist(data)
show()
figure("pcolor 1")
r = np.linspace(1., 16, 100)
th = np.linspace(0., np.pi, 100)
R, TH = np.meshgrid(r, th)
X = R*np.cos(TH)
Y = R*np.sin(TH)
Z = 4*TH+R
pcolor(X, Y, Z)
figure("pcolor 2")
pcolor(Z)
hot()
show()
if __name__ == '__main__':
main()
|