Skip to content

Instantly share code, notes, and snippets.

@rgerum
rgerum / gradient_patch.py
Created September 29, 2022 15:22
Gradient Patches for Matplotlib
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Polygon
def add_gradient_patch(polygon, start, end, color1=None, color2=None, stops=None, ax=None, count=100, debug=False, clip_on=True, **kwargs):
import matplotlib as mpl
import matplotlib.transforms as mtransforms
# get the axes