Skip to content

Instantly share code, notes, and snippets.


Will Thompson sefffal

View GitHub Profile
hugke729 /
Last active Sep 23, 2021
Simplify export of matplotlib figures when both raster and vector components are desired in output
# A function to rasterize components of a matplotlib figure while keeping
# axes, labels, etc as vector components
from inspect import getmembers, isclass
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def rasterize_and_save(fname, rasterize_list=None, fig=None, dpi=None,