Skip to content

Lazily import matplotlib #314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion wfdb/plot/plot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import matplotlib.pyplot as plt
import numpy as np
import os
import pdb
Expand Down Expand Up @@ -109,6 +108,8 @@ def plot_items(signal=None, ann_samp=None, ann_sym=None, fs=None,
figsize=(10,4), ecg_grids='all')

"""
import matplotlib.pyplot as plt

# Figure out number of subplots required
sig_len, n_sig, n_annot, n_subplots = get_plot_dims(signal, ann_samp)

Expand Down Expand Up @@ -227,6 +228,8 @@ def create_figure(n_subplots, sharex, sharey, figsize):
axes : list
The information needed for each subplot.
"""
import matplotlib.pyplot as plt

fig, axes = plt.subplots(
nrows=n_subplots, ncols=1, sharex=sharex, sharey=sharey, figsize=figsize
)
Expand Down
3 changes: 2 additions & 1 deletion wfdb/processing/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from multiprocessing import cpu_count, Pool

import matplotlib.pyplot as plt
import numpy as np
import requests

Expand Down Expand Up @@ -317,6 +316,8 @@ def plot(self, sig_style='', title=None, figsize=None,
The axes information for the plot.

"""
import matplotlib.pyplot as plt

fig = plt.figure(figsize=figsize)
ax = fig.add_subplot(1, 1, 1)

Expand Down