Closed RumbosN closed 7 years ago
I've added an option in the latest commit for plotrec:
def plotrec(record=None, title = None, annotation = None, annch = [0], timeunits='samples', returnfig = False, ecggrids=False):
Although the grids mess up the x axis label when the signal extends beyond a few seconds. Suggestions (from anyone) would be appreciated.
I was thinking of using ax.xaxis.set_major_locator(plt.MultipleLocator(1)) but this does not give what we exactly want.
So I tried with simply ploting lines instead of matplotlib ticks and it give a pretty result while having good x axis labels:
Adding seconds still keeps good x axis labels, but the grid is not readable anymore. I think you should add a "figsize" option to plotrec so that we can plot with a different size. This would allow to read such long plots.
if ecggrids:
major_ticks_x, minor_ticks_x, major_ticks_y, minor_ticks_y = calc_ecg_grids(
record.p_signals[:,ch], record.units[ch], record.fs, t, timeunits)
min_x, max_x = 0, numpy.max(t)
min_y, max_y = np.min(record.p_signals[:,ch]), np.max(record.p_signals[:,ch])
for tick in minor_ticks_x:
ax.plot([tick, tick], [min_y, max_y], c='#ededed', marker='|')
for tick in major_ticks_x:
ax.plot([tick, tick], [min_y, max_y], c='#bababa', marker='|')
for tick in minor_ticks_y:
ax.plot([min_x, max_x], [tick, tick], c='#ededed', marker='_')
for tick in major_ticks_y:
ax.plot([min_x, max_x], [tick, tick], c='#bababa', marker='_')
I've updated it using your code. Thanks!
Posibility of when you plot ECG signal appear the big box and small box that identify ms like the image: http://www.e-projects.ubi.pt/smart-clothing/images/fig11.jpg