Skip to content

Commit 29699f7

Browse files
added show to plots
1 parent 1c4cc8d commit 29699f7

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cs_util/plots.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
99
"""
1010

11+
import matplotlib
1112
import matplotlib.pylab as plt
1213
import numpy as np
1314

@@ -52,6 +53,13 @@ def savefig(fname, close_fig=True):
5253
plt.close()
5354

5455

56+
def show():
57+
backend = matplotlib.get_backend()
58+
if 'inline' in backend.lower() or 'nbagg' in backend.lower():
59+
plt.show() # Works in notebooks
60+
plt.close()
61+
62+
5563
def dx(idx, nx=3, fx=1.025, log=True):
5664
"""Dx.
5765

0 commit comments

Comments
 (0)