Skip to content

Commit 916ec90

Browse files
author
Benjamin Moody
committed
Merge pull request #314 into master
Import the matplotlib package only when needed.
2 parents 5955670 + 24d3319 commit 916ec90

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

wfdb/plot/plot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import matplotlib.pyplot as plt
21
import numpy as np
32
import os
43
import pdb
@@ -109,6 +108,8 @@ def plot_items(signal=None, ann_samp=None, ann_sym=None, fs=None,
109108
figsize=(10,4), ecg_grids='all')
110109
111110
"""
111+
import matplotlib.pyplot as plt
112+
112113
# Figure out number of subplots required
113114
sig_len, n_sig, n_annot, n_subplots = get_plot_dims(signal, ann_samp)
114115

@@ -227,6 +228,8 @@ def create_figure(n_subplots, sharex, sharey, figsize):
227228
axes : list
228229
The information needed for each subplot.
229230
"""
231+
import matplotlib.pyplot as plt
232+
230233
fig, axes = plt.subplots(
231234
nrows=n_subplots, ncols=1, sharex=sharex, sharey=sharey, figsize=figsize
232235
)

wfdb/processing/evaluate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from multiprocessing import cpu_count, Pool
22

3-
import matplotlib.pyplot as plt
43
import numpy as np
54
import requests
65

@@ -317,6 +316,8 @@ def plot(self, sig_style='', title=None, figsize=None,
317316
The axes information for the plot.
318317
319318
"""
319+
import matplotlib.pyplot as plt
320+
320321
fig = plt.figure(figsize=figsize)
321322
ax = fig.add_subplot(1, 1, 1)
322323

0 commit comments

Comments
 (0)