Repository navigation
Add xlabel and ylabel to plot_wfdb - #670
Merged
Merged
Conversation
plot_wfdb takes lists of x and y labels, passed to plot_items, to replace the default axis labels. plot_items checked the number of x labels against signal.shape, after signal had become a list of channels, so it failed with an AttributeError whenever xlabel was given. Check against the number of subplots, as for ylabel. Fixes #276.
tompollard
commented
Nov 23, 2026
tompollard
left a comment
Member
Author
There was a problem hiding this comment.
Reviewed 705e4b5. The custom x and y labels work for signal plots and annotation-only plots, and the default labels remain intact. I found no actionable issues. All 13 focused plotting tests pass; the remaining CI jobs are still running. Looks good to merge once they pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #276.
plot_wfdbnow takesxlabelandylabel, lists with a label for each channel, and passes them toplot_items, which already supported them. Without them the labels are as before: the signal names and units on the y axes, andtime/second(or the chosen unit) on the bottom x axis. The new arguments come last, so calls that pass arguments by position are unaffected.This also fixes
xlabelinplot_items, which has never worked: it checked the number of labels againstsignal.shape[1]aftersignalhad become a list of channels, so it raisedAttributeError: 'list' object has no attribute 'shape'. It now checks against the number of subplots, asylabeldoes.Testing
plot_wfdb, andxlabelinplot_items. The last two fail onmain.pytest -m "not network": all pass. Ruff and the docs build pass.@tompollard 🟥 red 🦥 sloth · aspen