Skip to content

Instantly share code, notes, and snippets.

@mwaskom
mwaskom / colormaps.md
Last active November 9, 2022 18:41
Four perceptually uniform colormaps in .jscm format

Sequential

  • rocket
  • mako

Diverging

  • icefire
  • vlag
@mwaskom
mwaskom / fsl_tbss.py
Created January 25, 2011 20:42
Standard TBSS implementation in Nipype
#! /usr/bin/env python
import os
from os.path import join as pjoin
import argparse
import nipype.interfaces.fsl as fsl
import nipype.interfaces.io as nio
import nipype.interfaces.utility as util
import nipype.pipeline.engine as pe
import nibabel as nib
@mwaskom
mwaskom / right_side_title.py
Created July 18, 2021 20:52
Put a title on the right y axis of a matplotlib axes using the set_title API.
import matplotlib as mpl
import matplotlib.pyplot as plt
f, ax = plt.subplots(figsize=(5, 5))
ax.set_title("Col title", y=1)
title = ax.set_title(
"Row title", loc="right", y=.5,
rotation=270, ha="left", va="center",
)
offset_trans = mpl.transforms.ScaledTranslation(
@mwaskom
mwaskom / crest.jscm
Created September 8, 2020 18:47
Perceptually-uniform colormaps for scatter and line plots
{
"content-type": "application/vnd.matplotlib.colormap-v1+json",
"name": "new cm",
"license": "http://creativecommons.org/publicdomain/zero/1.0/",
"usage-hints": [
"red-green-colorblind-safe",
"greyscale-safe",
"sequential"
],
"colorspace": "sRGB",
@mwaskom
mwaskom / histplot_api_examples.ipynb
Last active June 14, 2020 16:50
Draft of API examples for `seaborn.histplot`, prior to merge
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / histplot_features.ipynb
Last active June 13, 2020 21:17
Demo of some features from WIP seaborn.histplot
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / matplotlib_animation_of_large_scatterplot.ipynb
Created May 23, 2020 16:42
Animate a lot of points, quickly, in matplotlib
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / diag_diff_hist.ipynb
Created May 11, 2020 16:15
Scatterplot of x,y with hist of x-y
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / wide_to_long_transform.ipynb
Last active May 11, 2020 19:06
Notebook for figuring out consistent transformations from a variety of "wide" data to a long-form plot dataframe
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / covid_small_multiples.ipynb
Created April 2, 2020 16:28
Small-multiples approach to comparing cumulative case trajectories across states
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.