Skip to content

Instantly share code, notes, and snippets.

View pelson's full-sized avatar

Phil Elson pelson

View GitHub Profile
@pelson
pelson / iris_qplt_colorbar_control.ipynb
Created October 8, 2014 10:11
Describes how to get hold of the reference to the colorbar artists when using Iris' quickplot module.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pelson
pelson / gist:786ce4827aa1cd40b3f6
Created February 3, 2015 09:47
Work in progress support for plotting 360-day calendars with matplotlib
from collections import namedtuple
import datetime
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.transforms as mtransforms
import matplotlib.units as munits
import netcdftime
@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 / 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.
@pelson
pelson / nearest_interpolation.ipynb
Created September 3, 2015 10:34
An example of fixing nearest neighbour interpolation in iris
Loading
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.