Spaces:
Sleeping
Sleeping
import numpy as np | |
import plotly.graph_objects as go | |
def draw_radar_chart(data, categories): | |
arr = np.array(data, dtype='int') | |
fig = go.Figure() | |
fig.add_trace(go.Scatterpolar( | |
r=arr, | |
theta=categories, | |
fill='toself' | |
)) | |
fig.update_layout( | |
polar=dict( | |
radialaxis=dict( | |
visible=True, | |
range=(0, 100) | |
)), | |
showlegend=False | |
) | |
return fig | |
def draw_multi_radar_chart(data, categories): | |
# arr = np.array(data, dtype='int') | |
# categories = ['A', 'B', 'C', 'D', 'E'] | |
fig = go.Figure() | |
for arr in data: | |
fig.add_trace(go.Scatterpolar( | |
r=arr, | |
theta=categories, | |
fill='toself' | |
)) | |
fig.update_layout( | |
polar=dict( | |
radialaxis=dict( | |
visible=True, | |
range=(0, 100) | |
)), | |
showlegend=False | |
) | |
return fig | |