-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.py
63 lines (57 loc) · 1.72 KB
/
plot.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
#-*- coding: utf-8 -*-
import matplotlib.pyplot as uniquePyPlot
def plot(x, y, title='', xlabel='', ylabel=''):
uniquePyPlot.clf()
figure = uniquePyPlot
figure.scatter(x, y)
figure.title(title)
figure.xlabel(xlabel)
figure.ylabel(ylabel)
figure.autoscale(tight=True)
figure.grid()
figure.savefig(title + '.svg', format='svg')
#Plots multiple arrays.(Max. 5)
# plotArray[0][i]: X values for plot n°i
# plotArray[1][i]: Y values for plot n°i
def multiPlot(plotArray, title='', xlabel='', ylabel=''):
uniquePyPlot.clf()
figure = uniquePyPlot
figure.title(title)
figure.xlabel(xlabel)
figure.ylabel(ylabel)
markers = 'xo><v'
colors = 'rbgyo'
if len(plotArray[0]) > 5:
print 'More than 5 plots given as parameters (plotArray)'
return False
for i in xrange(len(plotArray[0])):
figure.scatter(
plotArray[0][i],
plotArray[1][i],
marker = markers[i],
c = colors[i]
)
figure.autoscale(tight=True)
figure.grid()
figure.savefig(title + '.svg', format='svg')
def plotLines(plotArray, title='', xlabel='', ylabel=''):
uniquePyPlot.clf()
figure = uniquePyPlot
figure.title(title)
figure.xlabel(xlabel)
figure.ylabel(ylabel)
markers = '+,.1234'
colors = 'rbgyo'
if len(plotArray[0]) > 5:
print 'More than 5 plots given as parameters (plotArray)'
return False
for i in xrange(len(plotArray[0])):
figure.plot(
plotArray[0][i],
plotArray[1][i],
marker = markers[i],
c = colors[i]
)
# figure.autoscale(tight=True)
figure.grid()
figure.savefig(title + '.svg', format='svg')