Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonny Williams jonnyhtw

View GitHub Profile
@jonnyhtw
jonnyhtw / discrete_cmap.py
Created Jul 29, 2020 — forked from jakevdp/discrete_cmap.py
Small utility to create a discrete matplotlib colormap
View discrete_cmap.py
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""
View ellipse_demo.py
import matplotlib.pyplot as plt
import numpy.random as rnd
from matplotlib.patches import Ellipse
NUM = 250
ells = [Ellipse(xy=rnd.rand(2)*10, width=rnd.rand(), height=rnd.rand(), angle=rnd.rand()*360)
for i in range(NUM)]
fig = plt.figure(0)
You can’t perform that action at this time.