# -*- coding: utf-8 -*-
"""
Created on Tue Oct 8 10:28:13 2019
@author: wagenerj
"""
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import geopandas as gpd
import pandas as pd
import matplotlib.pyplot as plt
import random
import mymod
import chart_studio.plotly as py
import plotly.graph_objs as go
counties = mymod.geefGebiedenGJSON()
df= mymod.geefGebiedenGDF()
app = dash.Dash(__name__)
#werkeend blok alles in 1 commando
# =============================================================================
# mygraph= dcc.Graph(
# figure = go.Figure(go.Choroplethmapbox(geojson=counties, locations=df.myindex, z=df.myval,
# colorscale="Viridis", zmin=0, zmax=12,
# marker_opacity=0.5, marker_line_width=0)
#
# ,layout=go.Layout(
# title='US Export of Plastic Scrap',
# showlegend=True,
# legend=go.layout.Legend(x=0, y=1.0),
# margin=go.layout.Margin(l=40, r=0, t=40, b=30)
# )
# ),style={'height': 300},id='my-graph')
#
# app.layout=html.Div(mygraph)
#
# =============================================================================
# =============================================================================
# myfigure=go.Figure(go.Choroplethmapbox(geojson=counties, locations=df.myindex, z=df.myval,
# colorscale="Viridis", zmin=0, zmax=6,
# marker_opacity=0.5, marker_line_width=0)
#
# ,layout=go.Layout(
# title='Gebieden Amsterdam values ',
# showlegend=True,
# legend=go.layout.Legend(x=0, y=1.0),
# margin=go.layout.Margin(l=40, r=0, t=40, b=30)
# ))
#
#
# myfigure.update_layout(mapbox_style="open-street-map", mapbox_zoom=3, mapbox_center = {"lat": 37.0902, "lon": -95.7129})
#
# mygraph= dcc.Graph(figure=myfigure,style={'height': 600},id='graf1')
#
# app.layout=html.Div([mygraph])
#
# =============================================================================
def makeChloromap() :
myChloromapbox =go.Choroplethmapbox(geojson=counties, locations=df.myindex, z=df.myval, hovertext="ok",
colorscale="Blues", zmin=0, zmax=6,
marker_opacity=1, marker_line_width=0)
myLayout=go.Layout(
title='Gebieden Amsterdam values ',
showlegend=True,
legend=go.layout.Legend(x=0, y=1.0),
margin=go.layout.Margin(l=40, r=0, t=40, b=30)
)
myfigure=go.Figure(myChloromapbox, myLayout)
myfigure.update_layout(mapbox_style="open-street-map", mapbox_zoom=10, mapbox_center = {"lat": 52.370216, "lon": 4.895168})
mygraph= dcc.Graph(figure=myfigure,style={'height': 600,'width':900},id='graf1')
return mygraph
def makeChloro():
myfigure = go.Figure(data=go.Choropleth(data=df,
locations=df['myindex'], # Spatial coordinates
z = df['myval'], # Data to be color-coded
locationmode = 'country names', # set of locations match entries in `locations`
colorscale = 'Reds',
colorbar_title = "Millions USD",
))
# myfigure.update_layout(mapbox_style="open-street-map", mapbox_zoom=10, mapbox_center = {"lat": 52.370216, "lon": 4.895168})
mygraph= dcc.Graph(figure=myfigure,style={'height': 600,'width':900},id='graf2')
return mygraph
app.layout=html.Div([makeChloro()])
if __name__ == '__main__':
app.run_server(debug=True)
Abonneren op:
Reacties posten (Atom)
Datums bepalen adhv begin en einddatum in Dataframe
Voorbeeld op losse velden ####################################################################### # import necessary packages from datetime...
-
value_counts geef per waarde het aantal voorkomens in een bepaalde df_iris.species.value_counts() versicolor 50 setosa 50 v...
-
import textfiles # Open a file: file file = open('opa.txt','r') # Print it print(file.read()) # Check whether file ...
-
scikit-learn, a standard library for machine learning in Python. It describes itself like this: Machine Learning in Python •Simple and...
Geen opmerkingen:
Een reactie posten