Spaces:
Sleeping
Sleeping
reverting to plot by name
Browse files- src/display.py +2 -1
- src/plot.py +0 -45
src/display.py
CHANGED
@@ -69,7 +69,8 @@ def display_app():
|
|
69 |
|
70 |
with column2:
|
71 |
if grid_response['selected_rows'] is not None and len(grid_response['selected_rows']) > 0:
|
72 |
-
figure = plot_radar_chart_rows(rows=grid_response['selected_rows'])
|
|
|
73 |
st.plotly_chart(figure, use_container_width=True)
|
74 |
else:
|
75 |
if len(subdata)>0:
|
|
|
69 |
|
70 |
with column2:
|
71 |
if grid_response['selected_rows'] is not None and len(grid_response['selected_rows']) > 0:
|
72 |
+
#figure = plot_radar_chart_rows(rows=grid_response['selected_rows'])
|
73 |
+
figure = plot_radar_chart_name(dataframe= dataframe, model_name=grid_response['selected_rows'][0]["model_name"])
|
74 |
st.plotly_chart(figure, use_container_width=True)
|
75 |
else:
|
76 |
if len(subdata)>0:
|
src/plot.py
CHANGED
@@ -108,51 +108,6 @@ def plot_radar_chart_name(dataframe: pd.DataFrame, model_name: str, categories:
|
|
108 |
return fig
|
109 |
|
110 |
|
111 |
-
@st.cache_data
|
112 |
-
def plot_radar_chart_index(dataframe: pd.DataFrame, index: int, categories: list = categories, fillcolor: str = fillcolor, line_color:str = line_color):
|
113 |
-
"""
|
114 |
-
plot the index-th row of the dataframe
|
115 |
-
|
116 |
-
Arguments:
|
117 |
-
dataframe: a pandas DataFrame
|
118 |
-
index: the index of the row we want to plot
|
119 |
-
categories: the list of the metrics
|
120 |
-
fillcolor: a string specifying the color to fill the area
|
121 |
-
line_color: a string specifying the color of the lines in the graph
|
122 |
-
"""
|
123 |
-
fig = go.Figure()
|
124 |
-
data = dataframe.loc[index,categories].to_numpy()*100
|
125 |
-
data = data.astype(float)
|
126 |
-
# rounding data
|
127 |
-
data = data.round(decimals = 2)
|
128 |
-
|
129 |
-
# add data to close the area of the radar chart
|
130 |
-
data = np.append(data, data[0])
|
131 |
-
categories_theta = categories.copy()
|
132 |
-
categories_theta.append(categories[0])
|
133 |
-
model_name = dataframe.loc[index,"model_name"]
|
134 |
-
#print("Printing data ", data, " for ", model_name)
|
135 |
-
|
136 |
-
fig.add_trace(go.Scatterpolar(
|
137 |
-
r=data,
|
138 |
-
theta=categories_theta,
|
139 |
-
fill='toself',
|
140 |
-
fillcolor = fillcolor,
|
141 |
-
opacity = opacity,
|
142 |
-
line=dict(color = line_color),
|
143 |
-
name= model_name
|
144 |
-
))
|
145 |
-
fig.update_layout(
|
146 |
-
polar=dict(
|
147 |
-
radialaxis=dict(
|
148 |
-
visible=True,
|
149 |
-
range=[0, 100.]
|
150 |
-
)),
|
151 |
-
showlegend=False
|
152 |
-
)
|
153 |
-
|
154 |
-
return fig
|
155 |
-
|
156 |
@st.cache_data
|
157 |
def plot_radar_chart_rows(rows: object, columns:list = columns, categories: list = categories, fillcolor: str = fillcolor, line_color:str = line_color):
|
158 |
"""
|
|
|
108 |
return fig
|
109 |
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
@st.cache_data
|
112 |
def plot_radar_chart_rows(rows: object, columns:list = columns, categories: list = categories, fillcolor: str = fillcolor, line_color:str = line_color):
|
113 |
"""
|