Ejemplo n.º 1
0
def update_map_constructeurs(input_value):
    """
    Change la plage de données à afficher sur la carte en fonction des années cochées
    Args:
        Series "year"[]
    """
    proddf = france[france.an_installation == 67]
    year_data = france[france.an_installation == 66]
    if input_value != []:
        for year in input_value:
            year_data = france[france.an_installation == year]
            proddf = pd.concat([proddf, year_data], ignore_index=True)
    else:
        proddf = france

    map_constructeurs = px.scatter_geo(proddf,
                                       lon="lon",
                                       lat="lat",
                                       scope='europe',
                                       size_max=15,
                                       center=center_lat_lon,
                                       color="panneaux_marque",
                                       projection="natural earth")

    map_constructeurs.update_layout(transition_duration=500,
                                    geo=dict(projection_scale=5))
    return map_constructeurs
def plot_map(loc_dataframe: pd.DataFrame):
    """Produce map and plots with meta-data on each potential job"""
    figure = px.scatter_geo(loc_dataframe,
                            lat="latitude",
                            lon="longitude",
                            hover_name='title',
                            text='id')
    figure.update_layout(mapbox_style="carto-darkmatter")
    figure.show()
Ejemplo n.º 3
0
def plot_confirmed(tsmap_corona):
    fig = px.scatter_geo(data_frame=tsmap_corona,
                         lat='Lat', lon='Long',
                         hover_name='Country/Region',
                         hover_data=['Province/State', 'Count'],
                         size='size',
                         animation_frame='Date',
                         size_max=40,
                         width=700, )
    return fig
Ejemplo n.º 4
0
def create_graph(selected_value):
    if selected_value == 'Above Benchmark':
        df = psi90_df.query('Rate > 1')
    else:
        df = psi90_df.query('Rate < 1')
    return px.scatter_geo(df,
                          lat='Latitude',
                          lon='Longitude',
                          locations='State',
                          locationmode='USA-states',
                          color='Provider_Name',
                          hover_name='Provider_Name',
                          scope='usa')
Ejemplo n.º 5
0
def update_map_production(input_value):
    """
    Change la plage de données à afficher sur la carte en fonction de la surface sélectionnée
    Args:
        input_value[0] min
        input_value[1] max
    """
    imax = np.exp(input_value[1])
    imin = np.exp(input_value[0])
    proddf = france[france.surface <= imax]
    proddf = proddf[proddf.surface >= imin]

    map_production = px.scatter_geo(proddf,
                                    lon="lon",
                                    lat="lat",
                                    scope='europe',
                                    size_max=10,
                                    center=center_lat_lon,
                                    color="production_surface",
                                    size="surface",
                                    projection="natural earth")
    map_production.update_layout(transition_duration=500,
                                 geo=dict(projection_scale=5))
    return map_production
px.line(gapminder, x="year", y="lifeExp", color="continent", 
        line_group="country", hover_name="country",
        line_shape="spline", render_mode="svg")


#长条图
a=px.strip(data, x="x", y="y", orientation="h", color="name")
a.write_html('6.html')


#箱型图
a=px.box(data, x="x", y="y", color="name", notched=True)
a.write_html('7.html')


#小提琴图
a=px.violin(data, y="y", x="x", color="name", box=True, points="all", 
          hover_data=data.columns)
a.write_html('8.html')

'''

#地图
a = px.scatter_geo(gapminder,
                   locations="iso_alpha",
                   color="continent",
                   hover_name="country",
                   size="pop",
                   animation_frame="year",
                   projection="natural earth")
a.write_html('9.html')
Ejemplo n.º 7
0
                re.sub(",",
                       "",
                       MM["Location Coordinates"][i].split()[0],
                       count=1)))
        Lon.append(float(MM["Location Coordinates"][i].split()[1]))
    else:
        Lat.append(float("nan"))
        Lon.append(float("nan"))
pass

#Add columns to original dataframe
MM["Lat"] = Lat
MM["Lon"] = Lon

#There is only one nan value, so we will delete it
sum(np.isnan(MM["Lat"]), 0)
MM = MM[~np.isnan(MM["Lat"])]

#Plot based on coordinates
GOLatLon = go.Figure()
GOLatLon = GOLatLon.add_trace(
    go.Scattergeo(lon=MM["Lon"], lat=MM["Lat"], mode="markers"))
GOLatLon.show()
#Use size of dead and missing as marker size and as color as well
GOLatLonSize = px.scatter_geo(data_frame=MM,
                              lat="Lat",
                              lon="Lon",
                              size="Total Dead and Missing",
                              color="Total Dead and Missing")
GOLatLonSize.show()