Skip to content

Instantly share code, notes, and snippets.

View pelson's full-sized avatar

Phil Elson pelson

View GitHub Profile
@pelson
pelson / README.md
Last active August 29, 2015 14:10
Season's greetings from matplotlib (2014). Very simple animated snow scene. (run the source, or see the result at https://www.youtube.com/watch?v=POnAkPpe770)

If working on XKCD style plotting for matplotlib taught me anything, it is that playing with software in a way that it was not originally designed to do can lead to some excellent discoveries (bugs) and generate new ideas and generalisations - not to mention it being a lot of fun!

So, in that vein, I wanted to put together a simple Christmas e-card using matplotlib. My main aim was to re-purpose some of the familiar matplotlib functionality to generate a simple festive animation.

I decided to go for a snowy scene, with a snow-capped greeting and sprig of holly. The snow is simply a scatter plot scaled by flake size and animated to fall in a pleasing way. The text is making use of the path effects functionality extended in v1.4 to add randomised "snow" around the text (the same effect employed by XKCD as it happens). And the holly is a nice demonstration of the power of Paths and vector rendering in matplotlib.

The source can be found at https://gist.github.com/pelson/ca795a02a420a1b9bfbc, and it requires m

@pelson
pelson / r2py_example.ipynb
Created January 27, 2015 10:14
A simple r2py example using Iris
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pelson
pelson / gist:e98e142b8a935142746b
Created April 14, 2015 08:26
um_packing performance.ipynb
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@pelson
pelson / biggus_expression.png
Last active August 29, 2015 14:22
Visualising biggus expressions in with networkx and dot (blue are results)
biggus_expression.png
@pelson
pelson / ipython.patch
Last active August 29, 2015 14:25
Changes to get IPython 3 to list kernels based on conda environments (requires conda on the path, and for the post-link.sh to be executed for each IPython enabled environment). This is a hack, and I expect there is a better way of doing this...
diff --git IPython/kernel/kernelspec.py IPython/kernel/kernelspec.py
index 0df16c7..d2df218 100644
--- IPython/kernel/kernelspec.py
+++ IPython/kernel/kernelspec.py
@@ -1,7 +1,9 @@
import io
import json
+import glob
import os
import shutil
@pelson
pelson / nearest_interpolation.ipynb
Created September 3, 2015 10:34
An example of fixing nearest neighbour interpolation in iris
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pelson
pelson / performance_nearest_vs_linear.ipynb
Created September 3, 2015 11:11
A comparison of performance for linear and nearest interpolation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pelson
pelson / OpenLayers.js
Last active September 18, 2015 12:19
Demonstration of constructing web map tile files. This is a useful step for static map tiles, though a further example using tornado to generate the tiles on the fly will follow - see pelson.github.io for.
/*
OpenLayers.js -- OpenLayers Map Viewer Library
Copyright (c) 2006-2013 by OpenLayers Contributors
Published under the 2-clause BSD license.
See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors.
Includes compressed code under the following licenses:
@pelson
pelson / nbagg_backend.ipynb
Last active September 19, 2015 08:00
A discussion on the new nbagg backend in matplotlib v1.4.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pelson
pelson / cdat_lite-5.2-1.tar.gz
Last active October 14, 2015 14:14
An upload of the lost source of CDAT-lite
This file has been truncated, but you can view the full file.