-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpplot.py
executable file
·47 lines (39 loc) · 1.05 KB
/
pplot.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
from numpy import *
from matplotlib.pyplot import *
def load():
result = []
for i in range(2):
result.append([])
with open('graph', 'r') as f:
for line in f:
val = map(float, line.split())
for i in range(2):
result[i].append(val[i])
return result
# radar green, solid grid lines
rc('grid', color='#316931', linewidth=1, linestyle='-')
rc('xtick', labelsize=15)
rc('ytick', labelsize=15)
# force square figure and square axes looks better for polar, IMO
width, height = matplotlib.rcParams['figure.figsize']
size = min(width, height)
# make a square figure
fig = figure(figsize=(size, size))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#ffffff')
another_bg = '#d5de9c'
line = load()
rad = line[0]
R = line[1]
n = len(line[0])
#print(n)
#R = array(R) - 20
def label(r):
return str(r) + "dB"
ax.plot(rad, R, color='#ee8d18', lw=3)
ax.set_yticks(range(0, 80, 20))
labels = map(str, range(-40, 40, 20))
labels[3] = labels[3] + 'dB'
ax.set_yticklabels(labels)
ax.set_rmax(80)
grid(True)
show()