Skip to content

Instantly share code, notes, and snippets.

@camriddell
camriddell / notes.2023-07-12.ipynb
Last active August 2, 2024 16:05
notes-2024-07-16.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@camriddell
camriddell / bumpchart.png
Last active May 24, 2024 15:06
Create a bump chart in Python using matplotlib
bumpchart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
from pathlib import Path
from numpy import sqrt, loadtxt, isclose
from pandas import read_table
from scipy.stats import t
def ttest(sample1, sample2):
vn1, vn2 = [s.var() / s.size for s in [sample1, sample2]]
from scipy.stats import norm, uniform, gamma
from matplotlib.pyplot import rc, rcdefaults, subplots, imread, show
from matplotlib.lines import Line2D
from matplotlib.ticker import MultipleLocator
from matplotlib.transforms import blended_transform_factory
from matplotlib.offsetbox import VPacker, TextArea, AnchoredOffsetbox, DrawingArea
from matplotlib.image import BboxImage
from numpy.random import default_rng
from pandas import DataFrame
from numpy.random import default_rng
from numpy import linspace, sin, cos
from matplotlib.pyplot import (
rcdefaults, rc, show, ion, figure,
pause, ioff, rcParams, waitforbuttonpress,
imread
)
@camriddell
camriddell / collect_univariates.py
Last active March 8, 2024 20:56
A collection of univariate plots
from functools import partial
from textwrap import fill
from scipy.stats import norm, uniform, skewnorm, gaussian_kde, triang
from numpy import (
array, linspace, quantile, histogram, atleast_2d, mean, std, add
)
from numpy.lib.stride_tricks import sliding_window_view
from matplotlib.pyplot import subplots, show, rc