Spaces:
Runtime error
Runtime error
gauravlochab
commited on
Commit
·
5e25fe1
1
Parent(s):
1107b51
refactor: Adjust bar gaps and group gaps in create_visualizations()
Browse files- app.py +19 -15
- app_trans_new.py +12 -3
app.py
CHANGED
@@ -212,12 +212,12 @@ def create_visualizations():
|
|
212 |
tickmode='array',
|
213 |
tickvals=df_tvl_daily['date'],
|
214 |
ticktext=df_tvl_daily['date'].dt.strftime('%b %d'),
|
215 |
-
tickangle
|
216 |
),
|
217 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
218 |
bargroupgap=0.1, # Decrease gap between bars in a group (0-1)
|
219 |
-
height=
|
220 |
-
width=
|
221 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
222 |
showlegend=True,
|
223 |
legend=dict(
|
@@ -225,7 +225,8 @@ def create_visualizations():
|
|
225 |
y=0.99,
|
226 |
xanchor="right",
|
227 |
x=0.99
|
228 |
-
)
|
|
|
229 |
)
|
230 |
fig_tvl.update_xaxes(tickformat="%b %d")
|
231 |
|
@@ -274,8 +275,8 @@ def create_visualizations():
|
|
274 |
),
|
275 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
276 |
bargroupgap=0.1, # Decrease gap between bars in a group (0-1)
|
277 |
-
height=
|
278 |
-
width=
|
279 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
280 |
showlegend=True,
|
281 |
legend=dict(
|
@@ -283,7 +284,8 @@ def create_visualizations():
|
|
283 |
y=0.99,
|
284 |
xanchor="right",
|
285 |
x=0.99
|
286 |
-
)
|
|
|
287 |
)
|
288 |
fig_swaps_chain.update_xaxes(tickformat="%m-%d")
|
289 |
|
@@ -319,8 +321,8 @@ def create_visualizations():
|
|
319 |
),
|
320 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
321 |
bargroupgap=0.1, # Decrease gap between bars in a group (0-1)
|
322 |
-
height=
|
323 |
-
width=
|
324 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
325 |
showlegend=True,
|
326 |
legend=dict(
|
@@ -328,7 +330,8 @@ def create_visualizations():
|
|
328 |
y=0.99,
|
329 |
xanchor="right",
|
330 |
x=0.99
|
331 |
-
)
|
|
|
332 |
)
|
333 |
fig_bridges_chain.update_xaxes(tickformat="%m-%d")
|
334 |
|
@@ -382,8 +385,8 @@ def create_visualizations():
|
|
382 |
tickangle=-45
|
383 |
),
|
384 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
385 |
-
height=
|
386 |
-
width=
|
387 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
388 |
showlegend=True,
|
389 |
legend=dict(
|
@@ -391,7 +394,8 @@ def create_visualizations():
|
|
391 |
y=0.99,
|
392 |
xanchor="right",
|
393 |
x=0.99
|
394 |
-
)
|
|
|
395 |
)
|
396 |
|
397 |
# Calculate weekly average daily active agents
|
@@ -419,8 +423,8 @@ def create_visualizations():
|
|
419 |
),
|
420 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
421 |
bargroupgap=0.1, # Decrease gap between bars in a group (0-1)
|
422 |
-
height=
|
423 |
-
width=
|
424 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
425 |
showlegend=True,
|
426 |
legend=dict(
|
|
|
212 |
tickmode='array',
|
213 |
tickvals=df_tvl_daily['date'],
|
214 |
ticktext=df_tvl_daily['date'].dt.strftime('%b %d'),
|
215 |
+
tickangle=-45,
|
216 |
),
|
217 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
218 |
bargroupgap=0.1, # Decrease gap between bars in a group (0-1)
|
219 |
+
height=600,
|
220 |
+
width=1000, # Specify width to prevent bars from being too wide
|
221 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
222 |
showlegend=True,
|
223 |
legend=dict(
|
|
|
225 |
y=0.99,
|
226 |
xanchor="right",
|
227 |
x=0.99
|
228 |
+
),
|
229 |
+
template='plotly_white'
|
230 |
)
|
231 |
fig_tvl.update_xaxes(tickformat="%b %d")
|
232 |
|
|
|
275 |
),
|
276 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
277 |
bargroupgap=0.1, # Decrease gap between bars in a group (0-1)
|
278 |
+
height=600,
|
279 |
+
width=1000, # Specify width to prevent bars from being too wide
|
280 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
281 |
showlegend=True,
|
282 |
legend=dict(
|
|
|
284 |
y=0.99,
|
285 |
xanchor="right",
|
286 |
x=0.99
|
287 |
+
),
|
288 |
+
template='plotly_white'
|
289 |
)
|
290 |
fig_swaps_chain.update_xaxes(tickformat="%m-%d")
|
291 |
|
|
|
321 |
),
|
322 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
323 |
bargroupgap=0.1, # Decrease gap between bars in a group (0-1)
|
324 |
+
height=600,
|
325 |
+
width=1000, # Specify width to prevent bars from being too wide
|
326 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
327 |
showlegend=True,
|
328 |
legend=dict(
|
|
|
330 |
y=0.99,
|
331 |
xanchor="right",
|
332 |
x=0.99
|
333 |
+
),
|
334 |
+
template='plotly_white'
|
335 |
)
|
336 |
fig_bridges_chain.update_xaxes(tickformat="%m-%d")
|
337 |
|
|
|
385 |
tickangle=-45
|
386 |
),
|
387 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
388 |
+
height=600,
|
389 |
+
width=1000, # Specify width to prevent bars from being too wide
|
390 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
391 |
showlegend=True,
|
392 |
legend=dict(
|
|
|
394 |
y=0.99,
|
395 |
xanchor="right",
|
396 |
x=0.99
|
397 |
+
),
|
398 |
+
template='plotly_white'
|
399 |
)
|
400 |
|
401 |
# Calculate weekly average daily active agents
|
|
|
423 |
),
|
424 |
bargap=0.6, # Increase gap between bar groups (0-1)
|
425 |
bargroupgap=0.1, # Decrease gap between bars in a group (0-1)
|
426 |
+
height=600,
|
427 |
+
width=1000, # Specify width to prevent bars from being too wide
|
428 |
margin=dict(l=50, r=50, t=50, b=50), # Add margins
|
429 |
showlegend=True,
|
430 |
legend=dict(
|
app_trans_new.py
CHANGED
@@ -412,10 +412,15 @@ def create_active_agents_visualizations():
|
|
412 |
fig = go.Figure()
|
413 |
|
414 |
fig.add_trace(go.Bar(
|
415 |
-
x=[f'
|
416 |
y=avg_agents_per_week,
|
417 |
-
|
418 |
-
|
|
|
|
|
|
|
|
|
|
|
419 |
))
|
420 |
|
421 |
# Update layout
|
@@ -426,6 +431,10 @@ def create_active_agents_visualizations():
|
|
426 |
xaxis=dict(
|
427 |
tickangle=-45 # Rotate x-axis labels to 45 degrees
|
428 |
),
|
|
|
|
|
|
|
|
|
429 |
template='plotly_white'
|
430 |
)
|
431 |
|
|
|
412 |
fig = go.Figure()
|
413 |
|
414 |
fig.add_trace(go.Bar(
|
415 |
+
x=[f'{week.strftime("%b %d")}' for week in weeks],
|
416 |
y=avg_agents_per_week,
|
417 |
+
marker_color='blue',
|
418 |
+
opacity=0.7,
|
419 |
+
text=None,
|
420 |
+
hoverlabel=dict(
|
421 |
+
bgcolor="white",
|
422 |
+
font_size=12,
|
423 |
+
),
|
424 |
))
|
425 |
|
426 |
# Update layout
|
|
|
431 |
xaxis=dict(
|
432 |
tickangle=-45 # Rotate x-axis labels to 45 degrees
|
433 |
),
|
434 |
+
height=600,
|
435 |
+
width=1000,
|
436 |
+
bargap=0,
|
437 |
+
bargroupgap=0.2,
|
438 |
template='plotly_white'
|
439 |
)
|
440 |
|