Tonic commited on
Commit
47d00cd
·
verified ·
1 Parent(s): 3b06ce9

solves plotly display errors

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -2063,22 +2063,23 @@ def make_prediction_enhanced(symbol: str, timeframe: str = "1d", prediction_days
2063
  text=f'Enhanced Stock Prediction for {symbol}',
2064
  x=0.5,
2065
  xanchor='center',
2066
- font=dict(size=20, color='black'),
2067
- y=0.98
2068
  ),
2069
  height=1000,
2070
  showlegend=True,
2071
  legend=dict(
2072
  orientation="h",
2073
- yanchor="bottom",
2074
- y=0.99,
2075
- xanchor="right",
2076
- x=1,
2077
- bgcolor='rgba(255,255,255,0.8)',
2078
  bordercolor='black',
2079
- borderwidth=1
 
2080
  ),
2081
- margin=dict(t=120, b=80, l=80, r=80),
2082
  autosize=True,
2083
  hovermode='x unified'
2084
  )
@@ -2111,9 +2112,9 @@ def make_prediction_enhanced(symbol: str, timeframe: str = "1d", prediction_days
2111
  for i in range(len(fig.layout.annotations)):
2112
  if i < 3:
2113
  fig.layout.annotations[i].update(
2114
- font=dict(size=14, color='darkblue', family='Arial, sans-serif'),
2115
- y=fig.layout.annotations[i].y + 0.02,
2116
- bgcolor='rgba(255,255,255,0.8)',
2117
  bordercolor='lightgray',
2118
  borderwidth=1
2119
  )
 
2063
  text=f'Enhanced Stock Prediction for {symbol}',
2064
  x=0.5,
2065
  xanchor='center',
2066
+ font=dict(size=18, color='black'),
2067
+ y=0.95 # Moved down slightly to avoid overlap
2068
  ),
2069
  height=1000,
2070
  showlegend=True,
2071
  legend=dict(
2072
  orientation="h",
2073
+ yanchor="top",
2074
+ y=-0.15, # Position legend below all subplots
2075
+ xanchor="center",
2076
+ x=0.5, # Center the legend horizontally
2077
+ bgcolor='rgba(255,255,255,0.9)',
2078
  bordercolor='black',
2079
+ borderwidth=1,
2080
+ font=dict(size=10) # Smaller font for better fit
2081
  ),
2082
+ margin=dict(t=120, b=150, l=80, r=80), # Increased bottom margin for legend
2083
  autosize=True,
2084
  hovermode='x unified'
2085
  )
 
2112
  for i in range(len(fig.layout.annotations)):
2113
  if i < 3:
2114
  fig.layout.annotations[i].update(
2115
+ font=dict(size=13, color='darkblue', family='Arial, sans-serif'),
2116
+ y=fig.layout.annotations[i].y + 0.01, # Reduced adjustment to prevent overlap
2117
+ bgcolor='rgba(255,255,255,0.9)',
2118
  bordercolor='lightgray',
2119
  borderwidth=1
2120
  )