def px_plot(data, colls, animate_or_not): for cl in colls: ind = np.where(data[cl].notna())[0] data = data.iloc[ind, :] print(cl) if animate_or_not: fig = px.density_mapbox(data, lat='lat', lon='lng', z=cl, radius=5, center=dict(lat=0, lon=180), zoom=0, animation_frame=cl, mapbox_style="stamen-terrain") filen = (os.path.join(figures_path, ('html_files/htmls_animated/TEDS_nx_map_' + str(cl) + '_animated.html'))) else: fig = px.density_mapbox(data, lat='lat', lon='lng', z=cl, radius=10, center=dict(lat=0, lon=180), zoom=0, mapbox_style="stamen-terrain") filen = (os.path.join( figures_path, ('html_files/TEDS_nx_map_' + str(cl) + '.html'))) fig.update_layout( title_text=('2017 US state ' + str(cl) + ' <br>(Click legend to toggle traces)'), showlegend=True, paper_bgcolor='white', # margin={"r":0,"t":0,"l":0,"b":0}, geo=dict(scope='usa', landcolor='rgb(217, 217, 217)'), mapbox_style="carto-positron", #"carto-positron", mapbox_zoom=3, mapbox_center={ "lat": 37.0902, "lon": -95.7129 }, ) # htmkl file plotly.offline.plot(fig, filename=filen) fig.show()
def update_graph(grade_bounds, safety_fil, radius_v): [min_g, max_g] = grade_bounds PG_bool = ('PG13' in safety_fil) R_bool = ('R' in safety_fil) X_bool = ('X' in safety_fil) df_filter = filter_data(df, min_g, max_g, PG_bool, R_bool, X_bool) fig = px.density_mapbox( df_filter, lat='latitude', lon='longitude', z='stars', radius=radius_v, hover_name='name', hover_data={ 'longitude': False, 'latitude': False, 'area': True, 'stars': True, 'rating': True }, #colorscale = Jet, center=dict(lat=34.012, lon=-116.168), zoom=10, opacity=0.7) fig['layout']['uirevision'] = 'some-constant' fig.update_layout(mapbox_style="open-street-map") return fig
def cmap_three(): dalian_three = pd.read_csv(DATA_PATH.joinpath("clustering_three.csv")) fig = px.density_mapbox( dalian_three, lat='lat', lon='lon', z='deal_totalPrice', hover_data=["xiaoqu", "address", "deal_totalPrice", "deal_unitPrice"], radius=10) fig.update_layout( autosize=True, hovermode='closest', mapbox_style="open-street-map", mapbox=dict( accesstoken=mapbox_access_token, bearing=0, center=dict(lat=38.9146, lon=121.619), pitch=0, zoom=9, ), ) fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 10}) return fig
def make_map(): import plotly.express as px fig = px.density_mapbox(data, lat='Latitude', lon='Longitude', z='Magnitude', radius=10, center=dict(lat=0, lon=180), zoom=0, mapbox_style="stamen-terrain") divs.append(html.Div([dcc.Graph(figure=fig)]))
def firms_heatmap(data): trace = data heat_fig = px.density_mapbox(trace, lat="latitude", lon="longitude", radius=data["frp_scaled"], zoom=3, mapbox_style="open-street-map", ) return(heat_fig)
def den_plot(par=den_group): fig = px.density_mapbox(ALZ_map, lat='start_lat', lon='start_lng', z=f'{par}', radius=10, zoom=3) fig.update_layout(mapbox_style="open-street-map") fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0}) return st.plotly_chart(fig, use_container_width=True)
def mapplot(mongodb_collection, api_key): query = { 'google_place_search_api_result.geometry.location': { '$exists': 1 } } projection = { 'id': 1, 'name': 1, '_id': 0, 'google_place_search_api_result.geometry.location.lat': 1, 'google_place_search_api_result.geometry.location.lng': 1, 'google_place_search_api_result.name': 1 } results_raw = mongodb_collection.find(query, projection) df = pd.DataFrame( columns=['id', 'name', 'lat', 'lng', 'formatted_name', 'size']) list_of_dicts = list() for elem in results_raw: size = 7 id = elem['id'] formatted_name = elem['google_place_search_api_result']['name'] name = elem['name'] lat = elem['google_place_search_api_result']['geometry']['location'][ 'lat'] lng = elem['google_place_search_api_result']['geometry']['location'][ 'lng'] dict_ = { "id": id, "name": name, "latitude": lat, "longitude": lng, "formatted_name": formatted_name, "size": size } list_of_dicts.append(dict_) df = pd.DataFrame.from_dict(list_of_dicts, orient='columns') BBox = ((df.longitude.min(), df.longitude.max(), df.latitude.min(), df.latitude.max())) # set mapbox acess token px.set_mapbox_access_token(api_key) # fig = px.scatter_mapbox(df, lat="latitude", lon="longitude", text="formatted_name", zoom=4) # fig = px.scatter_mapbox(df, lat="latitude", lon="longitude", zoom=4, size="size") # plot figure (density mapbox) fig = px.density_mapbox(df, lat="latitude", lon="longitude", radius=25, zoom=2, mapbox_style="light") fig.show()
def update_output(start_date, end_date): # print("Start date: " + start_date) # print("End date: " + end_date) dff = df.loc[start_date:end_date] # print(dff[:5]) fig = px.density_mapbox(dff, lat='LATITUDE', lon='LONGITUDE', z='APP_SQ_FT', radius=13, zoom=10, height=650, center=dict(lat=40.751418, lon=-73.963878), mapbox_style="carto-positron", hover_data={'BUSINESS_NAME': True, 'LATITUDE': False, 'LONGITUDE': False, 'APP_SQ_FT': True}) return fig
def plot_heatmap(df): center = dict(lat=df['Latitude'].mean(), lon=df['Longitude'].mean()) fig = px.density_mapbox( df, lat='Latitude', lon='Longitude', # z='Magnitude', radius=10, center=center, zoom=10, mapbox_style="open-street-map") # fig.update_layout(height=800) return fig
def update_heatmap(weight, allday, borough, year, week, day): # if only one value chosen its just a string so we cast to array if type(borough) == str: borough = [borough] if type(year) == str: year= [year] if type(week) == str: week= [week] if type(day) == str: day= [day] # if allday is chosen use whole data set else only corresponding hour if allday == '0': currDisplayData = heat_data_all_hours else: currDisplayData = hour_options[weight] lat_lon_data=currDisplayData[(currDisplayData['BOROUGH'].isin(borough)) & (currDisplayData['Year'].isin(year)) & (currDisplayData['Week'].isin(week)) & (currDisplayData['WeekDay'].isin(day))] # plot all lot, lon data from the current filters if lat_lon_data.shape[0] < 1: fig = px.density_mapbox(lat=[0], lon=[0], radius=10, center=dict(lat=40.7812, lon=-73.9665), zoom=10, opacity=0.0, mapbox_style="stamen-toner", height=500) else: fig = px.density_mapbox(lat_lon_data, lat='LATITUDE', lon='LONGITUDE', radius=5, center=dict(lat=40.7812, lon=-73.9665), zoom=10, opacity=0.5, mapbox_style="stamen-toner", height=500) fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0}) fig.update_traces(hovertemplate=None, hoverinfo='skip') fig.update_layout(uirevision=True) # if allday is chosen show slider and label else hide it if allday == '0': return fig, {'display': 'none'}, {'display': 'none'} else: return fig, {'display': 'block'}, {'display': 'block'}
def update_map(selected_charities): # x data is the charities selected in the dropdown, y data is the corresponding number of interactions # for these charities # df = df[selected_charities] # print(df.head()) df_map = df[df['charity'].isin(selected_charities)] fig = px.density_mapbox(df_map, lat='latitude', lon='longitude', radius=10, center=dict(lat=51.453, lon=-2.585), zoom=13, mapbox_style="stamen-terrain") # make the data list for a bar plot using the x and y data and set the layout parameters. # These are returned to update the bar plot return fig
def plot_heatmap(input_range=[0,168]): df_crashes_merged_plot = df_crash[(df_crash['Hour_of_the_week']>input_range[0]) & (df_crash['Hour_of_the_week']<input_range[1])] global observations_in_timeframe observations_in_timeframe= len(df_crashes_merged_plot) fig_map = px.density_mapbox(df_crashes_merged_plot, lat='LATITUDE', lon='LONGITUDE', z='Involved', radius=3, hover_data={'LATITUDE':False,'LONGITUDE':False,'Killed':True,'Injured':True, 'Time':True}, center = {"lat": 40.730610, "lon": -73.935242}, zoom=9, mapbox_style="carto-positron") fig_map.update_layout( margin=dict(l=0, r=0, t=0, b=0), hovermode="closest", font=dict(color='#737a8d'), coloraxis_showscale=False) return fig_map
def grafica_2(id): df2 = load_grafica2() return px.density_mapbox( df2, lat="lat", lon="long", z="size", radius=40, center=dict(lat=5, lon=-75), zoom=4, mapbox_style="stamen-terrain", title="Distribución geografica de ganadores", )
def plot_heatmap(df, parameter, state): latitude = df[df['state_name'] == state][['latitude', 'longitude' ]].mean(axis=0)['latitude'] longitude = df[df['state_name'] == state][['latitude', 'longitude' ]].mean(axis=0)['longitude'] df = df[df['parameter_name'] == parameter] fig = px.density_mapbox(df,\ lat='latitude',\ lon='longitude',\ z='arithmetic_mean',\ radius=10, animation_frame= 'year', center=dict(lat=latitude, lon=longitude), zoom=5.5, mapbox_style= 'carto-positron') fig
def heat_map(): """ Build heatmap with color gradient for iptcc """ # mark_size = [100 for i in df.index] fig = px.density_mapbox(df, lat='latitude', lon='longitude', z='iptcc', radius=30, center=dict(lat=0, lon=180), zoom=4, height=450) # fig = px.scatter_mapbox(df, lat="latitude", lon="longitude", hover_data=["iptcc"], # color="iptcc", color_continuous_scale=['#7BD150', '#F6E626', '#F6E626', '#FC9129', '#FF1B00', '#6E1E80'], size=mark_size, size_max=10, zoom=4, ) fig.update_layout(mapbox_style="open-street-map") fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0}) return fig
def plotavg(hour = -2): path = '/Users/andrew/non_icloud_ncf/distcomp_project/avgDay/' file = path + 'Avg.csv' avgdf = pd.read_csv(file) if hour == -2: hours = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] if hour != -2: hours = [hour] for h in hours: havgdf=avgdf[(avgdf.Hour == h)] fig = px.density_mapbox(havgdf, lat='Latitudea', lon='Longitudea', z='Average', radius=10, center=dict(lat=40.730, lon=-73.935), zoom=8.3, mapbox_style="stamen-terrain") writepath = path + 'maps/hour'+str(h)+'.html' fig.write_html(writepath)
def compute(n_clicks, input1, input2, input3, input4, input5, input6): print(1) res = lats(input1, input2, input3, input4, input5, input6) fig = px.scatter_mapbox(res, lat="latitude", lon="longitude", hover_name="city", hover_data=[ 'provstate', 'country_txt', 'region_txt', 'attacktype1_txt', 'iday', 'imonth', 'iyear' ], labels={ 'provstate': 'State', 'country_txt': 'Country', 'region_txt': 'Region', 'iday': 'Day', 'imonth': 'Month', 'iyear': 'Year', 'attacktype1_txt': 'Attack Type' }, color='attacktype1', zoom=4, height=900) fig.update_layout(mapbox_style="open-street-map") fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0}) fig1 = px.density_mapbox(res, lat="latitude", lon="longitude", hover_name="city", hover_data=[ 'provstate', 'country_txt', 'region_txt', 'attacktype1_txt', 'iday', 'imonth', 'iyear' ], labels={ 'provstate': 'State', 'country_txt': 'Country', 'region_txt': 'Region', 'iday': 'Day', 'imonth': 'Month', 'iyear': 'Year', 'attacktype1_txt': 'Attack Type' }, zoom=3, mapbox_style='open-street-map', height=400) return (fig, fig1)
def heatmap(stream_file=""): twitter_df = pd.read_json(stream_file, lines=True) json_struct = json.loads(twitter_df.to_json(orient="records")) df_flat = pd.json_normalize(json_struct) df_flat['latlon'] = df_flat['user.location'].apply( lambda x: get_location(x)) df_flat[['lat', 'lon']] = pd.DataFrame(df_flat['latlon'].tolist(), index=df_flat.index) fig = px.density_mapbox(df_flat, lat="lat", lon="lon", radius=5, center=dict(lat=0, lon=180), zoom=0, mapbox_style="open-street-map") py.offline.plot(fig, filename="test.html")
def compute1(n_clicks, inp1, inp2, inp3, inp4): print(1) res1 = lats1(inp1, inp2, inp3, inp4) data1 = data[data['country_txt'] == 'India'] state_cnt_list = [] for i in data1['provstate'].unique(): state_cnt_list.append(data['provstate'].value_counts()[i]) m = interp1d([1, max(state_cnt_list)], [5, 18]) circle_radius = m(state_cnt_list) fig1 = px.density_mapbox(res1, lat="latitude", lon="longitude", hover_name="city", zoom=3, radius=circle_radius, mapbox_style='open-street-map', height=400) return (fig1)
def new_map(self): df = pd.read_csv( '../novel-corona-virus-2019-dataset/covid_19_data.csv', parse_dates=['Last Update']) df.rename(columns={ 'ObservationDate': 'Date', 'Country/Region': 'Country' }, inplace=True) df_confirmed = pd.read_csv( "../novel-corona-virus-2019-dataset/time_series_covid_19_confirmed.csv" ) df_confirmed.rename(columns={'Country/Region': 'Country'}, inplace=True) df_confirmed = df_confirmed[[ "Province/State", "Lat", "Long", "Country" ]] df_temp = df.copy() df_temp['Country'].replace({'Mainland China': 'China'}, inplace=True) df_latlong = pd.merge(df_temp, df_confirmed, on=["Country", "Province/State"]) fig = px.density_mapbox( df_latlong, lat="Lat", lon="Long", hover_name="Province/State", hover_data=["Confirmed", "Deaths", "Recovered"], animation_frame="Date", color_continuous_scale="Portland", radius=7, zoom=0, height=700) fig.update_layout( title= 'Worldwide Corona Virus Cases Time Lapse - Confirmed, Deaths, Recovered', font=dict(family="Courier New, monospace", size=18, color="#7f7f7f")) fig.update_layout(mapbox_style="open-street-map", mapbox_center_lon=0) fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0}) #self.MplWidget.canvas.figure=fig fig.show()
def create_US_GeoMap_Death(self): df_confirmed_US = pd.read_csv( "../novel-corona-virus-2019-dataset/time_series_covid_19_deaths_US.csv" ) df_confirmed_US = df_confirmed_US.drop([ 'UID', 'iso2', 'iso3', 'code3', 'FIPS', 'Admin2', 'Combined_Key', 'Population' ], axis=1) df_confirmed_US.rename(columns={ 'Country_Region': 'Country', 'Province_State': 'Province/State', 'Long_': 'Long' }, inplace=True) df_confirmed_US = pd.melt( df_confirmed_US, id_vars=['Province/State', 'Country', 'Lat', 'Long'], var_name='Date', value_name='Deaths') df_confirmed_US = df_confirmed_US[df_confirmed_US['Deaths'] > 0] fig = px.density_mapbox(df_confirmed_US, lat="Lat", lon="Long", hover_name="Province/State", hover_data=["Deaths"], animation_frame="Date", color_continuous_scale="Portland", radius=7, zoom=0, height=700) fig.update_layout(title='Worldwide Deaths Cases', font=dict(family="Courier New, monospace", size=18, color="#7f7f7f")) fig.update_layout(mapbox_style="open-street-map", mapbox_center_lon=0) fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0}) fig.show() app = dash.Dash() app.layout = html.Div([dcc.Graph(figure=fig)]) app.run_server(debug=True, use_reloader=False)
def mapping(): message = 'Done' if request.method == 'GET': region = request.args.get('region', type=int) country = request.args.get('country', type=int) attacktype = request.args.get('attacktype', type=str) df = pd.read_csv("map.csv") if region == 0 and country == 0 and attacktype == 'All': #000 data = df elif region == 0 and country == 0: #001 f = (df['attacktype1_txt'] == attacktype) data = df[f] elif region == 0 and attacktype == 'All': #010 f = (df['country'] == country) data = df[f] elif region == 0: #0 11 f = (df['country'] == country) & (df['attacktype1_txt'] == attacktype) data = df[f] elif country == 0 and attacktype == 'All': #1 00 f = (df['region'] == country) data = df[f] elif country == 0: #1 01 f = (df['region'] == country) & (df['attacktype1_txt'] == attacktype) data = df[f] elif attacktype == 'All': #1 10 f = (df['country'] == country) & (df['region'] == region) data = df[f] else: #1 11 f = (df['country'] == country) & (df['region'] == region) & ( df['attacktype1_txt'] == attacktype) data = df[f] fig = px.density_mapbox(data, lat='latitude', lon='longitude', radius=5, zoom=4, mapbox_style='open-street-map') plotly.offline.plot(fig, filename='templates/names.html') return render_template('names.html')
def plotday(day = 'all', hour = -2, method='jnorm'): #change this path to your downloaded folder path = '/Users/andrew/non_icloud_ncf/distcomp_project/events/' #if a day is not specified, it will default to outputting every day if day == 'all': csvs = ['04_07','05_09','05_26','07_04','07_24','08_25','08_30','09_21','09_25'] if day != 'all': csvs = [day] #if hour is -2, this will output htmls for every hour of every specified day #the hour -1 may be in the data, this would correspond with the daily data if hour == -2: hours = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] if hour != -2: hours = [hour] for file in csvs: filename = path + file + '.csv' currentdf = pd.read_csv(filename) currentdf.drop(columns=['Unnamed: 0','Yearb','Monthb','Dayb','TempC','Type'], inplace=True) for h in hours: dfhour = currentdf[(currentdf.Hourb == h)] dfhour['Count'].fillna(0,inplace=True) dfhour['diff'] = dfhour.apply (lambda row: (row['Count']-row['Average']), axis=1) if method == 'anorm': absmax=max(abs(dfhour["diff"])) dfhour['diffnorm'] = dfhour.apply (lambda row: ((row['diff']+absmax)/absmax), axis=1) if method == 'jnorm': mi = min(dfhour["diff"]) mx = max(dfhour["diff"]) mn = dfhour["diff"].mean() dfhour['diffnorm'] = dfhour.apply (lambda row: (reshape(row['diff'], mi, mx, mn)), axis=1) # dfhour = dfhour[(round(dfhour.diffnorm,2) != .5)] # dfplotmore = dfhour[(dfhour.diffnorm > .5)] # dfplotless = dfhour[(dfhour.diffnorm < .5)] if method == 'count': # mi = min(dfhour["diff"]) dfhour['diffnorm'] = dfhour['diff']#dfhour.apply (lambda row: (dfhour['diff']), axis=1) #plotting both conditions fig = px.density_mapbox(dfhour, lat='Latitudeb', lon='Longitudeb', z='diffnorm', radius=10, center=dict(lat=40.730, lon=-73.935), zoom=8.3, mapbox_style="stamen-terrain") writepath = path + file + '/hour'+str(h)+'.html' fig.write_html(writepath)
def generate_density_map(current_df: pd.DataFrame): df = current_df.copy() df['lat-lng'] = current_df['customer.address.co_ordinate.coordinates'] fig = px.density_mapbox(df, lat=df['lat-lng'].str[1], lon=df['lat-lng'].str[0], z=df['payment_value'], radius=20, mapbox_style='basic', color_continuous_scale='RdYlGn', range_color=[0, df['payment_value'].max()], hover_data=[ df['payment_value'], df['product.category'], df['customer.address.customer_city'], df['customer.address.zip_code'] ]) fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0}) return fig
def create_density_map(data, data2): fig3 = px.density_mapbox(data, lat='latitude', lon='longitude', radius=10, center=dict(lat=0, lon=180), zoom=0, mapbox_style="stamen-terrain", height=350, title='Densidade de Avistamentos de OVNIs') fig3.add_trace( go.Scattermapbox(lat=data2['Latitude'], lon=data2['Longitude'], mode='markers', marker=go.scattermapbox.Marker(size=5, color='rgb(255, 0, 0)', opacity=0.7), text=data2['Name'], hoverinfo='text')) fig3.update_layout(margin={ "r": 0, "t": 50, "l": 0, "b": 0 }, paper_bgcolor=colors['background'], font_color=colors['text'], title={ 'xanchor': 'center', 'yanchor': 'top', 'y': 0.9, 'x': 0.5 }, mapbox={ 'accesstoken': token, 'zoom': 9, 'center': dict(lat=40.7, lon=-73.9) }) return fig3
def update_map(list_from_click, title): tw=select_tw(title) if list_from_click: list_of_stocks=[clk['x'].lower() for clk in list_from_click['points']] else: list_of_stocks=[tw.default_category] selected_df=tw.df_geo[tw.df_geo.Term.isin(list_of_stocks)] rng_min=selected_df.Tweets.min() rng_max=selected_df.Tweets.max() figure=px.density_mapbox(data_frame=selected_df,lat='lat', lon='lon', z='Tweets', radius=20, center = {"lat": 37.0902, "lon": -0.7129},zoom=0, hover_name="original_location", hover_data=["Tweets", "Term"], color_continuous_scale="Viridis", range_color=(rng_min, rng_max), mapbox_style="carto-positron") #figure.update_layout(margin={"r":1,"t":1.5,"l":1,"b":0.5}) figure.update_layout(margin={"t":3,"b":6}) return figure
def plotweather(type = 'all'): path = '/Users/andrew/non_icloud_ncf/distcomp_project/weather/' if type == 'all': types = ['broken_clouds','scattered_clouds','mist','clear','light_rain','few_clouds','overcast','moderate_rain','haze','fog','heavy_rain'] if type != 'all': types = [type] for t in types: file = path + t + '.csv' wtdf = pd.read_csv(file) wtdf['diff']= wtdf.apply(lambda row: (row['Count']-row['Average']), axis=1) wtdf.drop(['Count','Average'], inplace=True, axis = 1) wtdf2=wtdf.groupby(['Lat', 'Lng'], as_index=False).sum() mi = min(wtdf2["diff"]) mx = max(wtdf2["diff"]) mn = wtdf2["diff"].mean() wtdf2['diffnorm'] = wtdf.apply (lambda row: (reshape(row['diff'], mi, mx, mn)), axis=1) fig = px.density_mapbox(wtdf2, lat='Lat', lon='Lng', z='diffnorm', radius=10, center=dict(lat=40.730, lon=-73.935), zoom=8.3, mapbox_style="stamen-terrain") writepath = path + t + '.html' fig.write_html(writepath)
def generate_pred_plot(df_with_geometry): """Plots predicted Fuel Load.""" # assumes 'lat', 'lon' and 'predicted_load' as column headers for Latitude, Longitude, and Predicted Fuel Load fig_pred = px.density_mapbox( df_with_geometry, lat="lat", lon="lon", z="predicted_load", radius=3, center=dict(lat=0, lon=180), zoom=0, range_color=[0, 1.592246e11], mapbox_style="open-street-map", title="Predicted Fuel Load Estimate for " + month + " 2016", ) fig_pred.write_html(output_file_path_pred) print( "Predicted FL plot successfully generated! File saved to ", output_file_path_pred, )
def get_map_figure(self, dataframe, frame): figure_map = px.density_mapbox( dataframe[dataframe['Variable'] == self.variable], lat='latitude', lon='longitude', z=self.measure, radius=50, animation_group='Estación', animation_frame=frame, hover_name='Estación', color_continuous_scale='Jet', opacity=0.9) figure_map.update_layout(mapbox_style="open-street-map", mapbox_zoom=9.5, mapbox_center={ "lat": 4.60971, "lon": -74.08175 }) figure_map.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0}) return figure_map
def need_map(df_latest): title = "Location and received donations per project" value = 'target_amount_in_euro' px.set_mapbox_access_token( "pk.eyJ1Ijoia2V2aW5oZWxkIiwiYSI6ImNrNnRreGxmYjAwYXAzZnBoMmFoYnNzNXQifQ.JtnVD89sYgpWVcIA0ZW3fQ" ) #df = df.round({'latitude': 0, 'longitude': 0}) #df_group = df.groupby(["latitude", "longitude"], as_index=False).agg({value: 'sum', "country":"first"}) #df_latest = df.query('country != "Deutschland"') fig = px.density_mapbox( df_latest, lat="latitude", lon="longitude", #color="country", z=value, #color_continuous_scale=px.colors.cyclical.IceFire, radius=15, zoom=1, hover_name="title", hover_data=["carrier_name"], labels={value: "Donations (€)"}) fig.update_layout(showlegend=False, margin={ "l": 2, "r": 2, "t": 2, "b": 2 }, updatemenus=[{ "type": "dropdown" }], hovermode=False) return dbc.Card( [dbc.CardHeader(html.B(title)), dbc.CardBody([dcc.Graph(figure=fig)])], className="mt-2")