#collapse-hide
labels = ['Isolated', 'Threatened', 'Endangered', 'Abandoned', 'Extinct']
colors = ['rgb(0, 157, 220)', 'rgb(128, 206, 237)', 'rgb(255, 182, 128)',
'rgb(255, 115, 13)', 'rgb(242, 23, 13)']
traces = []
for i in range(1, 6):
traces.append(dict(
type = 'scattergeo',
lon = language_ind[language_ind.risk == i]['longitude'],
lat = language_ind[language_ind.risk == i]['latitude'],
text = language_ind[language_ind.risk == i]['language'],
mode = 'markers',
name = labels[i-1],
marker = dict(
size = 12,
opacity = 0.85,
color = colors[i-1],
line = dict(color = 'rgb(255, 255, 255)', width = 1)
)
))
# print(traces)
layout = dict(
title = 'Languages by Latitude/Longitude in India (2016)<br>'
'<sub>Click Legend to Display or Hide Categories</sub>',
showlegend = True,
legend = dict(
x = 0.85, y = 0.4
),
geo = dict(
scope = 'asia',
showland = True,
landcolor = 'rgb(250, 250, 250)',
subunitwidth = 1,
subunitcolor = 'rgb(217, 217, 217)',
countrywidth = 1,
countrycolor = 'rgb(217, 217, 217)',
showlakes = True,
lakecolor = 'rgb(255, 255, 255)')
)
figure = dict(data = traces, layout = layout)