Commit 24d3319
Benjamin Moody
Lazily import matplotlib.
A few functions (wfdb.plot_items, wfdb.plot.plot.create_figure,
wfdb.processing.Comparitor.plot) can be used to display graphical
plots using matplotlib.
When the matplotlib module is imported, it does a lot of non-trivial
initialization, which is slow and will sometimes fail in unpredictable
ways (depending on the environment and depending on whether other
nominally-optional dependencies, such as Tk, are installed.)
It's rather absurd for the behavior of importing wfdb to be dependent
on existence or non-existence of a window system, so only import
matplotlib in the few functions that actually use it.1 parent 5bb2e3c commit 24d3319
2 files changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
109 | 108 | | |
110 | 109 | | |
111 | 110 | | |
| 111 | + | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
| 231 | + | |
| 232 | + | |
230 | 233 | | |
231 | 234 | | |
232 | 235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
317 | 316 | | |
318 | 317 | | |
319 | 318 | | |
| 319 | + | |
| 320 | + | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
| |||
0 commit comments