Python cung cấp nhiều thư viện xử lý dữ liệu địa lý và đồ thị. Plotly là một trong những thư viện vẽ đồ thị địa lý. Plotly miễn phí, open source. Plotly vẽ nhiều loại biểu đồ: line chart, horizontal bar chart, bar chart, dashboard, scatter plot, bubble chart, pie chart...
import plotly.plotly as py
import plotly.graph_objs as go
import pandas as pd
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot, plot
init_notebook_mode()
data = dict(
type='choropleth',
locations=['AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FM', 'FL', 'GA', 'GU', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY'],
locationmode='USA-states',
colorscale='Portland',
text=['state 1', 'state 2', 'state 3', 'state 4', 'state 5', 'state 6', 'state 7', 'state 8', 'state 9', 'state 10', 'state 11', 'state 12', 'state 13', 'state 14', 'state 15', 'state 16', 'state 17', 'state 18', 'state 19', 'state 20'],
z=[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0],
colorbar={'title': 'USA-states'}
)
layout = dict(geo={'scope': 'usa'})
choromap = go.Figure(data=[data], layout=layout)
iplot(choromap)
Kết quả

Với biểu đồ, có thể visualize dữ liệu (input items) theo nhiều cách dựa trên mục đích. Có thể visualize các bang của Ấn Độ (29 bang) với màu khác nhau dựa trên đảng cầm quyền hoặc sở thích ăn uống (chay/mặn) hoặc bất kỳ ý tưởng nào. Plotly cung cấp thư viện mạnh mẽ, tương tác để visualize dữ liệu dễ hiểu (đồ thị).