cyberosa
commited on
Commit
·
88f9d70
1
Parent(s):
dc66018
improving errors by mech layout
Browse files- tabs/error.py +20 -25
tabs/error.py
CHANGED
|
@@ -130,31 +130,26 @@ def plot_week_error_data_by_market(error_df: pd.DataFrame, week: str) -> gr.Plot
|
|
| 130 |
|
| 131 |
def plot_weekly_errors_by_mech(errors_by_mech: pd.DataFrame) -> gr.Plot:
|
| 132 |
"""Function to plot the weekly errors by mech address"""
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
},
|
| 154 |
-
text="errors_percentage",
|
| 155 |
-
height=HEIGHT,
|
| 156 |
-
width=WIDTH,
|
| 157 |
-
)
|
| 158 |
fig.update_traces(
|
| 159 |
texttemplate="%{y} (%{text:.2f}%)",
|
| 160 |
textposition="outside",
|
|
|
|
| 130 |
|
| 131 |
def plot_weekly_errors_by_mech(errors_by_mech: pd.DataFrame) -> gr.Plot:
|
| 132 |
"""Function to plot the weekly errors by mech address"""
|
| 133 |
+
fig = px.bar(
|
| 134 |
+
errors_by_mech,
|
| 135 |
+
x="request_month_year_week",
|
| 136 |
+
y="requests",
|
| 137 |
+
color="error_cat",
|
| 138 |
+
barmode="group",
|
| 139 |
+
color_discrete_sequence=["green", "orange"],
|
| 140 |
+
labels={
|
| 141 |
+
"requestmonthyearweek": "Month-Year-Week",
|
| 142 |
+
"requests": "Number of Requests",
|
| 143 |
+
"error_cat": "Error Category",
|
| 144 |
+
"errors_percentage": "Percentage",
|
| 145 |
+
},
|
| 146 |
+
text="errors_percentage",
|
| 147 |
+
height=600,
|
| 148 |
+
width=800,
|
| 149 |
+
facet_col="mech_address",
|
| 150 |
+
facet_col_spacing=0.5,
|
| 151 |
+
facet_col_wrap=1,
|
| 152 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
fig.update_traces(
|
| 154 |
texttemplate="%{y} (%{text:.2f}%)",
|
| 155 |
textposition="outside",
|