This repository has been archived by the owner on Jul 11, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotting.py
64 lines (44 loc) · 1.48 KB
/
plotting.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
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
class Plotting:
def createPositionPlot(self, xLabel, dataFile, fileName):
chunkSize = 10000
lowerThreshold = 10 * chunkSize
higherThreshold = 200 * chunkSize
position_vector, count_vector = np.loadtxt(dataFile, delimiter = ', ', \
usecols = (0,1), dtype = int, unpack = True)
lowerFlags = count_vector > lowerThreshold
higherFlags = count_vector < higherThreshold
thresholdFlags = np.logical_and(lowerFlags, higherFlags)
filtered_position_vector = position_vector[thresholdFlags]
filtered_count_vector = count_vector[thresholdFlags]
filtered_count_vector = filtered_count_vector / chunkSize
#print("Filtered out %.2f%%" % ())
plt.plot(filtered_position_vector, filtered_count_vector, 'b.')
plt.savefig(fileName)
def createHeatMap2D(self, xLabel, yLabel, data, fileName):
fig, ax = plt.subplots()
heatmap = ax.pcolor(data, cmap=plt.cm.Reds)
ax.set_xticks(np.arange(data.shape[0])+0.5, minor=False)
ax.set_yticks(np.arange(data.shape[1])+0.5, minor=False)
ax.invert_yaxis()
ax.set_xticklabels(xLabel, minor=False)
ax.set_yticklabels(yLabel, minor=False)
plt.plot()
plt.savefig(fileName)
'''
x = np.empty([max_y, max_x])
x[:,:] = count_vector
plt.tick_params(
axis='y',
which='both',
left='off',
right='off',
labelright='off',
labelleft='off'
)
plt.contourf(x)
plt.savefig(fileName)
'''