Skip to content

Instantly share code, notes, and snippets.

View bdjackson's full-sized avatar

Brett Jackson bdjackson

View GitHub Profile
@bdjackson
bdjackson / SetMidpoint.py
Last active September 15, 2021 23:55
Setting the midpoint of a matplotlib colormap
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
class MidpointNormalize(mpl.colors.Normalize):
"""
class to help renormalize the color scale
"""
def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
self.midpoint = midpoint
import numpy
import pandas
# fill a random dataframe
# Example taken from:
# http://pandas.pydata.org/pandas-docs/version/0.15.0/visualization.html
ts = pandas.Series(numpy.random.randn(1000),
index=pandas.date_range('1/1/2000',
periods=1000))
ts = ts.cumsum()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bdjackson
bdjackson / remove_big_files.md
Last active March 3, 2016 22:19
RemoveBigFilesFromGitRepo

The easiest fix I have found for this problem is to change the backend from "MacOS" to "TkAgg". This can be done in each file or interactive session, but that is a bit cumbersome. It's also possible to change this in the matplotlibrc file:

~|⇒ cat  ~/.matplotlib/matplotlibrc
backend: TkAgg