Any ideas why a second trace (cloropleth) from geojson would work in plotly but not dash?
The plotly code (WORKS):
import json
import plotly.graph_objects as go
import pandas as pd
import numpy as np
bath = json.load(open("assets/bath_1_3_5k_simple_30km_rewound.geojson"))
bath_atr = pd.read_pickle("assets/bath_1_3_5k_simple_30km_atr")
cords = pd.read_pickle("assets/data/processed/cords_latest")
cords_sub = cords.loc[cords.FolderId == "6903751",:]
fig = go.Figure(go.Scattergeo())
#Add line from data
fig.add_trace(go.Scattergeo(
mode = "lines",
lon = cords_sub['gps_lon'],
lat = cords_sub['gps_lat'],
marker = {'size': 10},
name = "6903751",
))
#Add ocean contours
fig.add_trace(go.Choropleth(geojson=bath,
locations=bath_atr.id,
z=bath_atr.depth,
featureidkey='id',
colorscale=[[0, 'rgb(232, 239, 242)'], [1, 'rgb(143, 174, 189)']],
marker_line_width=0))
fig.update_geos(
projection_type="orthographic", #Globe visualization
resolution=110,
)
fig.show()
The same exact code but with dash componets (DOES NOT WORK):
import json
import plotly.graph_objects as go
import pandas as pd
import numpy as np
import dash
import dash_core_components as dcc
import dash_html_components as html
bath = json.load(open("assets/bath_1_3_5k_simple_30km_rewound.geojson"))
bath_atr = pd.read_pickle("assets/bath_1_3_5k_simple_30km_atr")
cords = pd.read_pickle("assets/data/processed/cords_latest")
cords_sub = cords.loc[cords.FolderId == "6903751",:]
fig = go.Figure(go.Scattergeo())
#Add line from data
fig.add_trace(go.Scattergeo(
mode = "lines",
lon = cords_sub['gps_lon'],
lat = cords_sub['gps_lat'],
marker = {'size': 10},
name = "6903751",
))
#Add ocean contours
fig.add_trace(go.Choropleth(geojson=bath,
locations=bath_atr.id,
z=bath_atr.depth,
featureidkey='id',
colorscale=[[0, 'rgb(232, 239, 242)'], [1, 'rgb(143, 174, 189)']],
marker_line_width=0))
fig.update_geos(
projection_type="orthographic", #Globe visualization
resolution=110,
)
app = dash.Dash()
app.layout = html.Div([
dcc.Graph(figure=fig)
])
app.run_server(debug=True, use_reloader=False)