<jupyter_start><jupyter_text>**Choropleth Map**A choropleth map (from Greek χῶρος "area/region" and πλῆθος "multitude") is a thematic map in which areas are shaded or patterned in proportion to the measurement of the statistical variable being displayed on the map, such as population density or per-capita income.<jupyter_code>init_notebook_mode(connected=True)
# First - create the data as a dictionary
# Colorscape - Jet, Portland, Greens, et al
data = dict(type= 'choropleth',
           locations=['AZ','CA','NY'],
           locationmode= 'USA-states',
           colorscale='Jet',
           text=['text 1','text 2','text 3'],
           z=[1.0,2.0,3.0],
           colorbar={'title':'Colorbar Title Goes Here'})
data
# Second create a Layout object as a nested Dictionary
layout=dict(geo={'scope':'usa'})<jupyter_output><empty_output><jupyter_text>Pass in data as a dictionary inside of a list Need a Data object and a Layout objectgo.Figure(data=[data],layout=layout)<jupyter_code># now create the map variable 
choromap = go.Figure(data=[data],layout=layout)
iplot(choromap)
# passing it into Plot will open it in HTML
plot(choromap)
colorscale='Portland'
data2 = dict(type= 'choropleth',
           locations=['AZ','CA','NY'],
           locationmode= 'USA-states',
           colorscale='Portland',
           text=['Arizona','California','New York'],
           z=[10.0,40.0,25.0],
           colorbar={'title': f'Colorbar Title {colorscale}'})
choromap2 = go.Figure(data=[data2],layout=layout)
iplot(choromap2)<jupyter_output><empty_output><jupyter_text>2011_US_AGRI_Exports<jupyter_code># New stuff
import pandas as pd
df = pd.read_csv('2011_US_AGRI_Exports')
df.head()
colorscale='Portland'
data3 = dict(type= 'choropleth',
           locations=df['code'],
           locationmode= 'USA-states',
           colorscale='YlOrRd',
           text=df['text'],
           z=df['total exports'],
           marker=dict(line = dict(color = 'rgb(12,12,12)',width=1)), # rgb(255,255,255) for white borders
           colorbar={'title': 'Millions USD'})
data3
layout3 = dict(title = '2011 US Agricultural by State',
              geo = dict(scope='usa',showlakes=True,lakecolor='rgb(85,173,240)'))
layout3
choromap3 = go.Figure(data=[data3],layout=layout3)
iplot(choromap3)
plot(choromap3)<jupyter_output><empty_output><jupyter_text>World Maps<jupyter_code>df10 = pd.read_csv('2014_World_GDP')
df10.head()
data10 = dict(
        type = 'choropleth',
        locations = df10['CODE'],
        z = df10['GDP (BILLIONS)'],
        text = df10['COUNTRY'],
        colorbar = {'title' : 'GDP Billions US'},
      ) 
layout10 = dict(
    title = '2014 Global GDP',
    geo = dict(
        showframe = False,
        projection = {'type':'natural earth'}
    )
)
choromap10 = go.Figure(data = [data10],layout = layout10)
iplot(choromap10)
plot(choromap10)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14320388349514562, 'fraction_numerical': 0.03432732316227462, 'mean_word_length': 3.98272884283247, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '585900', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 1032, 'n_tokens_neox': 957, 'n_words': 219, 'path': 'Global GDP and US Agriculture by State - Geographical Data Plotting with Choropleth Maps.ipynb', 'repo_name': 'jsutch/Pandas_Seaborn_MatPlotLib', 'size': '2884'}