import matplotlib.pyplot as plt
from contextlib import contextmanager
@contextmanager
def figsize_as(width, height):
original_figsize = plt.rcParams['figure.figsize']
try:
plt.rcParams['figure.figsize'] = [width, height]
yield
finally:
plt.rcParams['figure.figsize'] = original_figsize
# Example usage:
with figsize_as(4, 4):
fig, ax = plt.subplots()
ax.plot([0, 1], [0, 1])
plt.show()
Popular repositories Loading
-
-
audience_programming
audience_programming Publici think theprimeagen's vim-with-me is pretty cool
Rust 1
-
-
-
-
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.