Spaces:
Sleeping
Sleeping
gauravlochab
commited on
Commit
·
89d2387
1
Parent(s):
464321b
feat: change default visibility of agents to hidden and update y-axis range for improved clarity
Browse files
app.py
CHANGED
|
@@ -700,8 +700,8 @@ def create_combined_time_series_graph(df):
|
|
| 700 |
x_values = agent_data['timestamp'].tolist()
|
| 701 |
y_values = agent_data['apr'].tolist()
|
| 702 |
|
| 703 |
-
#
|
| 704 |
-
is_visible =
|
| 705 |
|
| 706 |
# Add data points as markers for APR
|
| 707 |
fig.add_trace(
|
|
@@ -717,7 +717,7 @@ def create_combined_time_series_graph(df):
|
|
| 717 |
),
|
| 718 |
name=f'Agent: {agent_name} (APR)',
|
| 719 |
hovertemplate='Time: %{x}<br>APR: %{y:.2f}<br>Agent: ' + agent_name + '<extra></extra>',
|
| 720 |
-
visible=is_visible #
|
| 721 |
)
|
| 722 |
)
|
| 723 |
logger.info(f"Added APR data points for agent {agent_name} with {len(x_values)} points (visible: {is_visible})")
|
|
@@ -740,7 +740,7 @@ def create_combined_time_series_graph(df):
|
|
| 740 |
),
|
| 741 |
name=f'Agent: {agent_name} (Adjusted APR)',
|
| 742 |
hovertemplate='Time: %{x}<br>Adjusted APR: %{y:.2f}<br>Agent: ' + agent_name + '<extra></extra>',
|
| 743 |
-
visible=is_visible #
|
| 744 |
)
|
| 745 |
)
|
| 746 |
logger.info(f"Added Adjusted APR data points for agent {agent_name} with {len(x_values_adj)} points (visible: {is_visible})")
|
|
@@ -810,7 +810,7 @@ def create_combined_time_series_graph(df):
|
|
| 810 |
fig.update_layout(
|
| 811 |
title="Babydegen agents",
|
| 812 |
xaxis_title="Time",
|
| 813 |
-
yaxis_title="
|
| 814 |
template="plotly_white",
|
| 815 |
height=700, # Increased height
|
| 816 |
width=1400, # Increased width
|
|
@@ -826,29 +826,16 @@ def create_combined_time_series_graph(df):
|
|
| 826 |
hovermode="closest"
|
| 827 |
)
|
| 828 |
|
| 829 |
-
#
|
| 830 |
-
if len(unique_agents) > MAX_VISIBLE_AGENTS:
|
| 831 |
-
fig.add_annotation(
|
| 832 |
-
text=f"Note: Only showing top {MAX_VISIBLE_AGENTS} agents by default. Toggle others in legend.",
|
| 833 |
-
xref="paper", yref="paper",
|
| 834 |
-
x=0.5, y=1.05,
|
| 835 |
-
showarrow=False,
|
| 836 |
-
font=dict(size=12, color="gray"),
|
| 837 |
-
align="center"
|
| 838 |
-
)
|
| 839 |
-
|
| 840 |
-
# Use fixed tick spacing for clarity
|
| 841 |
-
dtick = 5 # 5-unit ticks for better readability
|
| 842 |
-
|
| 843 |
-
# Update y-axis with autoscaling and improved appearance
|
| 844 |
fig.update_yaxes(
|
| 845 |
showgrid=True,
|
| 846 |
gridwidth=1,
|
| 847 |
gridcolor='rgba(0,0,0,0.1)',
|
| 848 |
-
#
|
| 849 |
-
autorange=
|
|
|
|
| 850 |
tickformat=".2f", # Format tick labels with 2 decimal places
|
| 851 |
-
tickfont=dict(size=
|
| 852 |
)
|
| 853 |
|
| 854 |
# Update x-axis with better formatting and autoscaling
|
|
@@ -860,7 +847,7 @@ def create_combined_time_series_graph(df):
|
|
| 860 |
autorange=True, # Explicitly enable autoscaling
|
| 861 |
tickformat="%b %d, %H:%M", # More detailed time format
|
| 862 |
tickangle=-30, # Angle the labels for better readability
|
| 863 |
-
tickfont=dict(size=
|
| 864 |
)
|
| 865 |
|
| 866 |
# SIMPLIFIED APPROACH: Do a direct plot without markers for comparison
|
|
@@ -1005,7 +992,7 @@ def create_combined_time_series_graph(df):
|
|
| 1005 |
simple_fig.update_layout(
|
| 1006 |
title="Babydegen agents",
|
| 1007 |
xaxis_title="Time",
|
| 1008 |
-
yaxis_title="
|
| 1009 |
yaxis=dict(
|
| 1010 |
# No fixed range - let Plotly autoscale
|
| 1011 |
autorange=True, # Explicitly enable autoscaling
|
|
|
|
| 700 |
x_values = agent_data['timestamp'].tolist()
|
| 701 |
y_values = agent_data['apr'].tolist()
|
| 702 |
|
| 703 |
+
# Change default visibility to False to hide all agent data points
|
| 704 |
+
is_visible = False
|
| 705 |
|
| 706 |
# Add data points as markers for APR
|
| 707 |
fig.add_trace(
|
|
|
|
| 717 |
),
|
| 718 |
name=f'Agent: {agent_name} (APR)',
|
| 719 |
hovertemplate='Time: %{x}<br>APR: %{y:.2f}<br>Agent: ' + agent_name + '<extra></extra>',
|
| 720 |
+
visible=is_visible # All agents hidden by default
|
| 721 |
)
|
| 722 |
)
|
| 723 |
logger.info(f"Added APR data points for agent {agent_name} with {len(x_values)} points (visible: {is_visible})")
|
|
|
|
| 740 |
),
|
| 741 |
name=f'Agent: {agent_name} (Adjusted APR)',
|
| 742 |
hovertemplate='Time: %{x}<br>Adjusted APR: %{y:.2f}<br>Agent: ' + agent_name + '<extra></extra>',
|
| 743 |
+
visible=is_visible # All agents hidden by default
|
| 744 |
)
|
| 745 |
)
|
| 746 |
logger.info(f"Added Adjusted APR data points for agent {agent_name} with {len(x_values_adj)} points (visible: {is_visible})")
|
|
|
|
| 810 |
fig.update_layout(
|
| 811 |
title="Babydegen agents",
|
| 812 |
xaxis_title="Time",
|
| 813 |
+
yaxis_title="Percent drawdown || Agent APR",
|
| 814 |
template="plotly_white",
|
| 815 |
height=700, # Increased height
|
| 816 |
width=1400, # Increased width
|
|
|
|
| 826 |
hovermode="closest"
|
| 827 |
)
|
| 828 |
|
| 829 |
+
# Update y-axis with fixed range of -50 to +100 for psychological effect
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 830 |
fig.update_yaxes(
|
| 831 |
showgrid=True,
|
| 832 |
gridwidth=1,
|
| 833 |
gridcolor='rgba(0,0,0,0.1)',
|
| 834 |
+
# Use fixed range instead of autoscaling
|
| 835 |
+
autorange=False, # Disable autoscaling
|
| 836 |
+
range=[-50, 100], # Set fixed range from -50 to +100
|
| 837 |
tickformat=".2f", # Format tick labels with 2 decimal places
|
| 838 |
+
tickfont=dict(size=16, family="Arial, sans-serif", color="black", weight="bold") # Larger and bold font for tick labels
|
| 839 |
)
|
| 840 |
|
| 841 |
# Update x-axis with better formatting and autoscaling
|
|
|
|
| 847 |
autorange=True, # Explicitly enable autoscaling
|
| 848 |
tickformat="%b %d, %H:%M", # More detailed time format
|
| 849 |
tickangle=-30, # Angle the labels for better readability
|
| 850 |
+
tickfont=dict(size=16, family="Arial, sans-serif", color="black", weight="bold") # Larger and bold font for tick labels
|
| 851 |
)
|
| 852 |
|
| 853 |
# SIMPLIFIED APPROACH: Do a direct plot without markers for comparison
|
|
|
|
| 992 |
simple_fig.update_layout(
|
| 993 |
title="Babydegen agents",
|
| 994 |
xaxis_title="Time",
|
| 995 |
+
yaxis_title="Percent drawdown || Agent APR",
|
| 996 |
yaxis=dict(
|
| 997 |
# No fixed range - let Plotly autoscale
|
| 998 |
autorange=True, # Explicitly enable autoscaling
|