-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPylabSampleExample.py
104 lines (90 loc) · 2.62 KB
/
PylabSampleExample.py
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
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 15 19:32:40 2023
@author: dadou
"""
import matplotlib.pylab as plt
mySamples = []
myLinear = []
myQuadratic = []
myCubic = []
myExponential = []
for i in range(0, 30):
mySamples.append(i)
myLinear.append(i)
myQuadratic.append(i ** 2)
myCubic.append(i ** 3)
myExponential.append(1.5 ** i)
plt.figure('lin')
plt.clf()
plt.title('Linear')
plt.ylim(0, 1000)
plt.plot(mySamples, myLinear, 'b-', label='linear')
plt.legend(loc='upper left')
plt.figure('quad')
plt.clf()
plt.title('Quadratic')
plt.ylim(0, 1000)
plt.plot(mySamples, myQuadratic, 'ro', label='quadratic')
plt.legend(loc='upper left')
plt.figure('cub')
plt.clf()
plt.title('Cubic')
plt.ylim(0, 1000)
plt.plot(mySamples, myCubic, 'g^', label='cubic')
plt.legend(loc='upper left')
plt.figure('exp')
plt.clf()
plt.title('Exponential')
plt.ylim(0, 1000)
plt.plot(mySamples, myExponential, label='exponential')
plt.legend(loc='upper left')
plt.figure('les4')
plt.clf()
plt.title('les 4 figures')
plt.ylim(0, 10000)
plt.plot(mySamples, myLinear, 'b-', label='linear')
plt.plot(mySamples, myQuadratic, 'ro', label='quadratic')
plt.plot(mySamples, myCubic, 'g^', label='cubic')
plt.plot(mySamples, myExponential, 'r--', label='exponential')
plt.legend(loc='upper left')
plt.figure('les4a')
plt.clf()
plt.title('les 4 figures')
plt.subplot(211)
plt.ylim(0, 10000)
plt.plot(mySamples, myLinear, 'b-', label='linear')
plt.plot(mySamples, myQuadratic, 'ro', label='quadratic')
plt.plot(mySamples, myCubic, 'g^', label='cubic')
plt.plot(mySamples, myExponential, 'r--', label='exponential')
plt.legend(loc='upper left')
plt.figure('les4b')
plt.clf()
plt.title('les 4 figures')
plt.subplot(212)
plt.ylim(0, 10000)
plt.plot(mySamples, myLinear, 'b-', label='linear')
plt.plot(mySamples, myQuadratic, 'ro', label='quadratic')
plt.plot(mySamples, myCubic, 'g^', label='cubic')
plt.plot(mySamples, myExponential, 'r--', label='exponential')
plt.legend(loc='upper left')
plt.figure('les4c')
plt.clf()
plt.title('les 4 figures')
plt.subplot(121)
plt.ylim(0, 10000)
plt.plot(mySamples, myLinear, 'b-', label='linear')
plt.plot(mySamples, myQuadratic, 'ro', label='quadratic')
plt.plot(mySamples, myCubic, 'g^', label='cubic')
plt.plot(mySamples, myExponential, 'r--', label='exponential')
plt.legend(loc='upper left')
plt.figure('les4d')
plt.clf()
plt.title('les 4 figures')
plt.subplot(122)
plt.ylim(0, 10000)
plt.plot(mySamples, myLinear, 'b-', label='linear')
plt.plot(mySamples, myQuadratic, 'ro', label='quadratic')
plt.plot(mySamples, myCubic, 'g^', label='cubic')
plt.plot(mySamples, myExponential, 'r--', label='exponential')
plt.legend(loc='upper left')