Skip to content

Instantly share code, notes, and snippets.

View phobson's full-sized avatar
⛏️

Paul Hobson phobson

⛏️
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phobson
phobson / horizon.ipynb
Last active June 21, 2019 22:24
Implementing cubism.js horizon charts in python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phobson
phobson / horizon.py
Created March 1, 2013 23:05
Trying to get a decent horizon implementation with matplotlib
# setup the environment
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, np.pi*4, 137)
y = (2*np.random.normal(size=137) + x**2)
# reflect everything around the origin
xx = np.hstack([-1*x[::-1], x])
yy = np.hstack([-1*y[::-1], y])
@phobson
phobson / horizon2.py
Last active March 14, 2017 16:03
Milla's version of horizons in python
import numpy as np
import matplotlib.pyplot as plt
def makeLayer(y, height):
neg=0.0
pos=0.0
if y > 0:
if y - height >= 0:
pos = height
y -= pos
@phobson
phobson / buggy_areas.py
Created March 4, 2013 22:10
Script to show weird rendering bug with multiple `fill_between` areas on many `twinx` axes
# setup the environment
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, np.pi*4, 137)
y = (2*np.random.normal(size=137) + x**2)
# reflect everything around the origin
xx = np.hstack([-1*x[::-1], x])
yy = np.hstack([-1*y[::-1], y])
@phobson
phobson / pval_compare.py
Created March 9, 2013 00:14
comparing p-values from independence tests between R and scipy
import numpy as np
import scipy.stats as stats
import rpy
import matplotlib.pyplot as plt
spy_p_paired = []
spy_p_nopair = []
rpy_p_paired = []
rpy_p_nopair = []
@phobson
phobson / pandas_for_stormwater.ipynb
Created April 4, 2013 02:03
pandas for stormwater
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phobson
phobson / units_conversion_simple.ipynb
Last active December 15, 2015 19:49
Units standardization using pandas. View it here: http://nbviewer.ipython.org/5314570
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phobson
phobson / flat_file2raster.ipynb
Last active March 3, 2016 18:20
Plotting a raster from a flat file
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phobson
phobson / gist:5467824
Last active December 16, 2015 17:08
netCDF stuff
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.