Skip to content

Plotting should use sharex=True by default #373

Closed
@bemoody

Description

@bemoody

When plotting multiple signals (from the same record), they should be horizontally aligned with each other, even if the time extents are not the same.

An example we ran into the other day:

r = wfdb.rdrecord('sample-data/multi-segment/p000878/p000878-2137-10-26-16-57', channels=[0, 1], sampto=7000)
wfdb.plot_wfdb(r)

This plot doesn't make it obvious that the two signals don't start at the same time. Compare:

wfdb.plot_items(r.p_signal, sharex=True)

In addition, setting sharex=True means that as you interactively scroll/zoom the plot, the time axis stays synchronized.

Therefore, I think plot_wfdb should, by default, invoke plot_items with sharex=True. Maybe plot_wfdb should accept a sharex argument (or share_time_axis?) itself.

Note that as it stands, sharex is incompatible with time_units='samples' (or rather, it does completely the wrong thing for multi-frequency records.) My suggestion would be to display frame numbers instead of sample numbers in this case, and/or to use seconds as the time unit by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions