Comparing 2016 presidential election cartograms from FiveThirtyEight, Washington Post, Wall Street Journal, NPR, and Daily Kos.
Uses Polylabel to pick some decent label positions.
See also: Jigsaw morphing, Smoother polygon transitions
# Based on Waveshare's epd5in65f.py demo. Copyright notice at end. | |
import sys | |
import os | |
picdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'pic') | |
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib') | |
if os.path.exists(libdir): | |
sys.path.append(libdir) |
license: mit |
#!/usr/bin/env python3 | |
# A text filter for BBEdit. If it encounters a JSON error, it writes an error message | |
# to stderr (appears in a new BBEdit window) and leaves the original text unaltered. | |
# c.f. http://crisp.tumblr.com/post/2574967567/json-pretty-print-formatting-in-bbedit | |
# c.f. http://blog.scottlowe.org/2013/11/11/making-json-output-more-readable-with-bbedit/ | |
import json | |
import sys | |
def main(): |
Comparing 2016 presidential election cartograms from FiveThirtyEight, Washington Post, Wall Street Journal, NPR, and Daily Kos.
Uses Polylabel to pick some decent label positions.
See also: Jigsaw morphing, Smoother polygon transitions
#!/usr/bin/env python | |
import numpy as np | |
import cv2 | |
from sys import argv | |
# Gaussian radius (should really be an argument): | |
r = 21 | |
src, dst = argv[1:] |
#!/usr/bin/env zsh | |
# ./day.sh month_number morning_day evening_day zoom_level | |
# Strictly alpha: for example, does not know how to handle | |
# month edges or unscheduled missing images. | |
set -eu | |
year=$1 |
import requests as req | |
import sys | |
from dateutil.parser import parse | |
from PIL import Image | |
from StringIO import StringIO | |
# hi8-fetch.py <date> <zoom level> <output> | |
# E.g.: hi8-fetch.py 2016-01-13T22:10:00 8 2016-01-13T221000-z8.png | |
# Fetch Himawari-8 full disks at a given zoom level. | |
# Valid zoom levels seem to be powers of 2, 1..16, and 20. |
#!/usr/bin/env python | |
# created by shuichinet https://gist.github.com/shuichinet | |
# forked from https://gist.github.com/shuichinet/8159878 21 Nov 2015 | |
# using minor edits by fcrimins https://www.reddit.com/user/fcrimins from https://www.reddit.com/r/google/comments/2xzgyv/remove_duplicate_songs_from_google_play_music/csh6mrh | |
# also using clever edits by Morgan Gothard https://medium.com/@mgothard | |
# updated for Python 3.5 by John M. Kuchta https://medium.com/@sebvance 22 Nov 2016 (hey I was busy) | |
# compiled by John M. Kuchta https://medium.com/@sebvance | |
# thanks to shuichinet, fcrimins and Mr. Gothard for their work |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="overlay.css"> | |
<link href='http://fonts.googleapis.com/css?family=Raleway:400,700' rel='stylesheet' type='text/css'> | |
<body> | |
<div id = "description"> | |
<h2>Is Africa bigger than North America?</h2> | |
<p><strong>Yes!</strong> In fact, North America, including United States, Canada, Mexico, and Greenland, could easily fit inside Africa with plenty of room left to add Central America, Argentina, Chile, and Bolivia too.</p> | |
<p>Most of the maps we use day to day distort the relative sizes of countries, making countries near the equator look relatively small and countries near the north and south pole look relatively huge. However, we can compare the true sizes of countries by using a different type of map.</p> | |
<div><button name="Sweden,Madagascar">Sweden vs Madagascar</button><button name="Australia,Antarctica">Australia vs Antarctica</button><button name="Europe,Brazil">Europe vs Brazil</button><button name="US,Australia">United States vs Australia</b |