-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgplot.py
More file actions
34 lines (24 loc) · 711 Bytes
/
gplot.py
File metadata and controls
34 lines (24 loc) · 711 Bytes
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
import matplotlib.pyplot as plt
def plot(x,y, **kwargs):
plt.figure(dpi=300)
plt.plot(x,y)
plt.grid(True)
for key, value in kwargs.items():
if key == 'title':
plt.title(value)
if key == 'xlabel':
plt.xlabel(value)
if key == 'ylabel':
plt.ylabel(value)
if key == 'xlim':
plt.xlim(value)
if key == 'ylim':
plt.ylim(value)
if key == 'grid':
plt.ylim(value)
plt.show()
if __name__ == '__main__':
x = range(10)
y = [ 2**c for c in x]
plot(x,y)
plot(x,y, xlabel='time (min)', ylabel='height (m)', title='Time vs Height')