plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
16.16k stars 2.54k forks source link

Add choropleth maps for metropolitan and non-metropolitan areas (MSA's) #1219

Closed mbkupfer closed 4 months ago

mbkupfer commented 6 years ago

Any chance we can add an ability to create choropleth maps of United States Metro and non-Metro Areas. I feel that this could be done since there is already a county map and metro are simply supersets of counties. Here is the definition of metro areas provided by the BLS. https://www.bls.gov/oes/current/area_definitions_m2017.xlsx The Excel sheet download can be used to map counties to metro and non-metro areas.

Here is an example of this used in practice

image

source

mbkupfer commented 6 years ago

Found this shape file that could be used: http://brenocon.com/geocode/cbsa.tiger2013.json.gz

Source

Will follow up later with my initial findings.

mbkupfer commented 6 years ago

@jonmmease, follow up: I inspected the shape file and good news! The GEOID is a perfect match to the AREA column in the definitions file above. The CBSA file is (almost) a superset of the area definitions w/over double the amount of areas. That said, there are some areas, 50 to be exact that are in the definitions, that aren't covered in the CBSA. I did a set difference and provided them below. These all seem to be metro divisions though which leads me to believe that their constituent metro areas will already be included.

As for coding this figure factory, I'm happy to give it a shot. I haven't used geopandas before, but it's coming pretty natural as I'm commonly using pandas. I also have _county_choropleth.py to work off of. Going to create a similar version called plotly/figure_factory/_core_based_statistical_areas.py. Will keep you posted.

{'Anaheim-Santa Ana-Irvine, CA Metropolitan Division',
 'Boston-Cambridge-Newton, MA NECTA Division',
 'Brockton-Bridgewater-Easton, MA NECTA Division',
 'Camden, NJ Metropolitan Division',
 'Chicago-Naperville-Arlington Heights, IL Metropolitan Division',
 'Dallas-Plano-Irving, TX Metropolitan Division',
 'Danbury, CT',
 'Detroit-Dearborn-Livonia, MI Metropolitan Division',
 'Dover-Durham, NH-ME',
 'Dutchess County-Putnam County, NY Metropolitan Division',
 'Elgin, IL Metropolitan Division',
 'Fort Lauderdale-Pompano Beach-Deerfield Beach, FL Metropolitan Division',
 'Fort Worth-Arlington, TX Metropolitan Division',
 'Framingham, MA NECTA Division',
 'Gary, IN Metropolitan Division',
 'Haverhill-Newburyport-Amesbury Town, MA-NH NECTA Division',
 'Lake County-Kenosha County, IL-WI Metropolitan Division',
 'Lawrence-Methuen Town-Salem, MA-NH NECTA Division',
 'Leominster-Gardner, MA',
 'Los Angeles-Long Beach-Glendale, CA Metropolitan Division',
 'Lowell-Billerica-Chelmsford, MA-NH NECTA Division',
 'Lynn-Saugus-Marblehead, MA NECTA Division',
 'Manchester, NH',
 'Mayaguez, PR',
 'Miami-Miami Beach-Kendall, FL Metropolitan Division',
 'Montgomery County-Bucks County-Chester County, PA Metropolitan Division',
 'Nashua, NH-MA NECTA Division',
 'Nassau County-Suffolk County, NY Metropolitan Division',
 'New Bedford, MA',
 'New Haven, CT',
 'New York-Jersey City-White Plains, NY-NJ Metropolitan Division',
 'Newark, NJ-PA Metropolitan Division',
 'Norwich-New London-Westerly, CT-RI',
 'Oakland-Hayward-Berkeley, CA Metropolitan Division',
 'Peabody-Salem-Beverly, MA NECTA Division',
 'Philadelphia, PA Metropolitan Division',
 'Portsmouth, NH-ME',
 'San Francisco-Redwood City-South San Francisco, CA Metropolitan Division',
 'San German, PR',
 'San Rafael, CA Metropolitan Division',
 'Seattle-Bellevue-Everett, WA Metropolitan Division',
 'Silver Spring-Frederick-Rockville, MD Metropolitan Division',
 'Springfield, MA-CT',
 'Tacoma-Lakewood, WA Metropolitan Division',
 'Taunton-Middleborough-Norton, MA NECTA Division',
 'Warren-Troy-Farmington Hills, MI Metropolitan Division',
 'Washington-Arlington-Alexandria, DC-VA-MD-WV Metropolitan Division',
 'Waterbury, CT',
 'West Palm Beach-Boca Raton-Delray Beach, FL Metropolitan Division',
 'Wilmington, DE-MD-NJ Metropolitan Division'}
gvwilson commented 4 months ago

Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson