DSatishchandra commited on
Commit
8c737b3
·
verified ·
1 Parent(s): b5fa6ba

Update modules/visuals.py

Browse files
Files changed (1) hide show
  1. modules/visuals.py +30 -0
modules/visuals.py CHANGED
@@ -1,5 +1,6 @@
1
  import streamlit as st
2
  import plotly.express as px
 
3
  import pandas as pd
4
 
5
  def display_dashboard(df, location):
@@ -19,6 +20,14 @@ def display_map_heatmap(df, location):
19
  if df.empty:
20
  st.warning("No data available for this location.")
21
  return
 
 
 
 
 
 
 
 
22
 
23
  # Debug: Print DataFrame to verify coordinates
24
  st.write("Debug: Sample Data", df[["Latitude", "Longitude", "AlertLevel"]].head()) # Temporary debug
@@ -72,4 +81,25 @@ def display_map_heatmap(df, location):
72
  traceorder="normal"
73
  )
74
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  st.plotly_chart(fig, use_container_width=True)
 
1
  import streamlit as st
2
  import plotly.express as px
3
+ import plotly.graph_object as go
4
  import pandas as pd
5
 
6
  def display_dashboard(df, location):
 
20
  if df.empty:
21
  st.warning("No data available for this location.")
22
  return
23
+
24
+ # Example DataFrame with location data
25
+ df = pd.DataFrame({
26
+ 'latitude': [17.385044, 17.444418],
27
+ 'longitude': [78.486671, 78.348397],
28
+ 'alert_level': ['red', 'yellow'],
29
+ 'location': ['Location A', 'Location B']
30
+ })
31
 
32
  # Debug: Print DataFrame to verify coordinates
33
  st.write("Debug: Sample Data", df[["Latitude", "Longitude", "AlertLevel"]].head()) # Temporary debug
 
81
  traceorder="normal"
82
  )
83
  )
84
+ fig.update_layout(
85
+ mapbox=dict(
86
+ style="open-street-map", # Base style
87
+ center=dict(lat=17.385044, lon=78.486671),
88
+ zoom=12 # Zoom to an appropriate level
89
+ )
90
+ )
91
+
92
+ fig.show()
93
+ fig = go.Figure(go.Scattermapbox(
94
+ lat=df['latitude'],
95
+ lon=df['longitude'],
96
+ mode='markers',
97
+ marker=go.scattermapbox.Marker(
98
+ size=14, # Increased size
99
+ color=df['alert_level'], # Colors based on alert level
100
+ colorscale='YlOrRd', # Set a color scale
101
+ opacity=0.9 # Increased opacity for visibility
102
+ ),
103
+ text=df['location'],
104
+ ))
105
  st.plotly_chart(fig, use_container_width=True)