Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update plotly, vega, googlemap, mapbox dependencies - WF-117 #640

Conversation

FabienArcellier
Copy link
Collaborator

@FabienArcellier FabienArcellier commented Nov 20, 2024

fix #635


image

main.py

import os

from dotenv import load_dotenv

import writer as wf
import plotly.express as px
import pandas as pd

load_dotenv()

def create_us_map():
    us_capitals = pd.DataFrame([
        {"state": "Alabama", "lat": 32.3792, "lon": -86.3077},
        {"state": "Alaska", "lat": 58.3019, "lon": -134.4197},
        {"state": "Arizona", "lat": 33.4484, "lon": -112.0740},
        {"state": "Arkansas", "lat": 34.7465, "lon": -92.2896},
        {"state": "California", "lat": 38.5816, "lon": -121.4944},
        {"state": "Colorado", "lat": 39.7391, "lon": -104.9847},
        {"state": "Connecticut", "lat": 41.7658, "lon": -72.6734},
        {"state": "Delaware", "lat": 39.1582, "lon": -75.5244},
        {"state": "Florida", "lat": 30.4383, "lon": -84.2807},
        {"state": "Georgia", "lat": 33.7490, "lon": -84.3880},
        {"state": "Hawaii", "lat": 21.3069, "lon": -157.8583},
        {"state": "Idaho", "lat": 43.6150, "lon": -116.2023},
        {"state": "Illinois", "lat": 39.7817, "lon": -89.6501},
        {"state": "Indiana", "lat": 39.7684, "lon": -86.1581},
        {"state": "Iowa", "lat": 41.5868, "lon": -93.6250},
        {"state": "Kansas", "lat": 39.0482, "lon": -95.6762},
        {"state": "Kentucky", "lat": 38.1970, "lon": -84.8631},
        {"state": "Louisiana", "lat": 30.4515, "lon": -91.1871},
        {"state": "Maine", "lat": 44.3106, "lon": -69.7795},
        {"state": "Maryland", "lat": 38.9784, "lon": -76.4922},
        {"state": "Massachusetts", "lat": 42.3601, "lon": -71.0589},
        {"state": "Michigan", "lat": 42.7325, "lon": -84.5555},
        {"state": "Minnesota", "lat": 44.9537, "lon": -93.0900},
        {"state": "Mississippi", "lat": 32.2988, "lon": -90.1848},
        {"state": "Missouri", "lat": 38.5767, "lon": -92.1735},
        {"state": "Montana", "lat": 46.5896, "lon": -112.0391},
        {"state": "Nebraska", "lat": 40.8136, "lon": -96.7026},
        {"state": "Nevada", "lat": 39.1638, "lon": -119.7674},
        {"state": "New Hampshire", "lat": 43.2081, "lon": -71.5376},
        {"state": "New Jersey", "lat": 40.2206, "lon": -74.7597},
        {"state": "New Mexico", "lat": 35.6870, "lon": -105.9378},
        {"state": "New York", "lat": 42.6526, "lon": -73.7562},
        {"state": "North Carolina", "lat": 35.7796, "lon": -78.6382},
        {"state": "North Dakota", "lat": 46.8083, "lon": -100.7837},
        {"state": "Ohio", "lat": 39.9612, "lon": -82.9988},
        {"state": "Oklahoma", "lat": 35.4676, "lon": -97.5164},
        {"state": "Oregon", "lat": 44.9429, "lon": -123.0351},
        {"state": "Pennsylvania", "lat": 40.2732, "lon": -76.8867},
        {"state": "Rhode Island", "lat": 41.8240, "lon": -71.4128},
        {"state": "South Carolina", "lat": 34.0007, "lon": -81.0348},
        {"state": "South Dakota", "lat": 44.3683, "lon": -100.3510},
        {"state": "Tennessee", "lat": 36.1627, "lon": -86.7816},
        {"state": "Texas", "lat": 30.2672, "lon": -97.7431},
        {"state": "Utah", "lat": 40.7608, "lon": -111.8910},
        {"state": "Vermont", "lat": 44.2601, "lon": -72.5754},
        {"state": "Virginia", "lat": 37.5407, "lon": -77.4360},
        {"state": "Washington", "lat": 47.0379, "lon": -122.9007},
        {"state": "West Virginia", "lat": 38.3498, "lon": -81.6326},
        {"state": "Wisconsin", "lat": 43.0731, "lon": -89.4012},
        {"state": "Wyoming", "lat": 41.1400, "lon": -104.8202}
    ])


    fig = px.scatter_map(us_capitals,
                         lat="lat",
                         lon="lon",
                         hover_name="state")

    fig.update_layout(
        title="United States map",
        mapbox_style="open-street-map",
        margin={"r": 0, "t": 40, "l": 0, "b": 0}
    )

    return fig


initial_state = wf.init_state({
    "map": create_us_map(),
    "google_map_api_key": os.getenv('GOOGLE_MAP_API_KEY'),
    "mapbox_api_key": os.getenv('MAPBOX_API_KEY'),
})

@FabienArcellier FabienArcellier added the bug Something isn't working label Nov 20, 2024
@FabienArcellier FabienArcellier self-assigned this Nov 20, 2024
@FabienArcellier FabienArcellier changed the title fix: update plotly, vega, googlemap dependencies fix: update plotly, vega, googlemap, mapbox dependencies Nov 21, 2024
@FabienArcellier FabienArcellier force-pushed the 635-plotlyexpressscatter_mapbox-deprecated-from-v524 branch from 5f8a4dc to 7ca7c25 Compare November 21, 2024 08:59
@FabienArcellier FabienArcellier changed the title fix: update plotly, vega, googlemap, mapbox dependencies fix: update plotly, vega, googlemap, mapbox dependencies - WF-117 Nov 21, 2024
@FabienArcellier FabienArcellier marked this pull request as ready for review November 21, 2024 10:42
@FabienArcellier FabienArcellier force-pushed the 635-plotlyexpressscatter_mapbox-deprecated-from-v524 branch from 7ca7c25 to 5e3fcb6 Compare November 22, 2024 19:48
@ramedina86 ramedina86 merged commit 129dd54 into writer:dev Nov 29, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plotly.express.scatter_mapbox deprecated from v5.24
2 participants