Skip to content

Commit

Permalink
Fix matplotlib colormap (#225)
Browse files Browse the repository at this point in the history
* Fix matplotlib colormap

* Add changelog entry

* Correct changelog entry
  • Loading branch information
cbrnr authored Jun 21, 2024
1 parent 94a85bb commit f457662
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## [UNRELEASED] - YYYY-MM-DD
### Fixed
- Fix `plot_ecg` for newer versions of Matplotlib ([#225](https://github.com/cbrnr/sleepecg/pull/225) by [Clemens Brunner](https://github.com/cbrnr))

## [0.5.8] - 2024-05-21
### Changed
Expand Down
3 changes: 1 addition & 2 deletions src/sleepecg/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def plot_ecg(
given by `heartbeats`.
"""
import matplotlib.pyplot as plt
from matplotlib.cm import get_cmap

t = np.arange(0, len(ecg) / fs, 1 / fs)
fig, ax = plt.subplots()
Expand All @@ -72,7 +71,7 @@ def plot_ecg(

ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)
colors = cycle(get_cmap("tab10").colors)
colors = cycle(plt.get_cmap("tab10").colors)
markers = cycle(("*", "o", "s", "D", "v", "<", ">", "^", "X", "p"))
for label, pos, color, marker in zip(kwargs.keys(), kwargs.values(), colors, markers):
ax.plot(
Expand Down

0 comments on commit f457662

Please sign in to comment.