Skip to content

Instantly share code, notes, and snippets.

@camriddell
camriddell / inset_axes_example.png
Last active September 1, 2023 17:27
Example of how one can use matplotlib transforms to inset an axes along each bar of a bar chart.
inset_axes_example.png
@camriddell
camriddell / Python Plotting - Working With Long Labels
Last active October 25, 2022 18:19
Summary of some of the ways one can work with long labels in both matplotlib & bokeh. Based on an example created in ggplot2 (R) https://www.andrewheiss.com/blog/2022/06/23/long-labels-ggplot/
We couldn’t find that file to show.
```python
from matplotlib.pyplot import figure, subplots, show, rc, rcdefaults
from numpy.random import default_rng
from numpy import linspace, atleast_2d
from pandas import DataFrame
from scipy.stats import gaussian_kde
from seaborn import stripplot, rugplot
rcdefaults()
rc('font', size=14)
@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
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
)
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
#!/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]]