xiaofeifei commited on
Commit
5e9d70a
1 Parent(s): 3741806

Signed-off-by: vax521 <13263397018@163.com>

Files changed (1) hide show
  1. utils.py +46 -0
utils.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import plotly.graph_objects as go
3
+
4
+
5
+ def draw_radar_chart(data, categories):
6
+ arr = np.array(data, dtype='int')
7
+ fig = go.Figure()
8
+ fig.add_trace(go.Scatterpolar(
9
+ r=arr,
10
+ theta=categories,
11
+ fill='toself'
12
+ ))
13
+ fig.update_layout(
14
+ polar=dict(
15
+ radialaxis=dict(
16
+ visible=True,
17
+ range=(0, 100)
18
+ )),
19
+ showlegend=False
20
+ )
21
+ return fig
22
+
23
+
24
+ def draw_multi_radar_chart(data, categories):
25
+ # arr = np.array(data, dtype='int')
26
+ # categories = ['A', 'B', 'C', 'D', 'E']
27
+
28
+ fig = go.Figure()
29
+ for arr in data:
30
+ fig.add_trace(go.Scatterpolar(
31
+ r=arr,
32
+ theta=categories,
33
+ fill='toself'
34
+ ))
35
+
36
+ fig.update_layout(
37
+ polar=dict(
38
+ radialaxis=dict(
39
+ visible=True,
40
+ range=(0, 100)
41
+ )),
42
+ showlegend=False
43
+ )
44
+
45
+ return fig
46
+