Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
sergiolucero / covid_folium.py
Created March 11, 2020 21:57
plotting COVID advance
import folium, pandas as pd
from folium.plugins import MarkerCluster
pdf = pd.read_json('https://tinyurl.com/covid19-github')
pdf = pdf[pdf.data==pdf.data.max()]
pdf = pdf[pdf.totale_casi>0]
location = pdf.describe()[['lat','long']].loc['50%'].values
fm = folium.Map(location=location, zoom_start=6, tile='stamentoner',
width=800, height=600)
@jdfekete
jdfekete / README.md
Last active April 14, 2024 12:23
Matrix diagram that visualizes character co-occurrences in Victor Hugo’s "Les Misérables"

Source: The Stanford GraphBase

A network can be represented by an adjacency matrix, where each cell ij represents an edge from vertex i to vertex j. Here, vertices represent characters in a book, while edges represent co-occurrence in a chapter.

Given this two-dimensional representation of a graph, a natural visualization is to show the matrix! However, the effectiveness of a matrix diagram is heavily dependent on the order of rows and columns: if related nodes are placed closed to each other, it is easier to identify clusters and bridges.

This example lets you try different orderings via the drop-down menu. This type of diagram can be extended with manual reordering of rows and columns, and expanding or collapsing of clusters, to allow deeper exploration. Jacques Bertin (or more specifically, his fleet of assistants) did this by hand with