This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A function to rasterize components of a matplotlib figure while keeping | |
# axes, labels, etc as vector components | |
# https://brushingupscience.wordpress.com/2017/05/09/vector-and-raster-in-one-with-matplotlib/ | |
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
MEASUREMENT = re.compile( | |
r'''( # group match like scanf() token %e, %E, %f, %g | |
[-+]? # +/- or nothing for positive | |
(\d+(\.\d*)?|\.\d+) # match numbers: 1, 1., 1.1, .1 | |
([eE][-+]?\d+)? # scientific notation: e(+/-)2 (*10^2) | |
) | |
(\s*) # separator: white space or nothing | |
( # unit of measure: like GB. also works for no units | |
\S*)''', re.VERBOSE) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.