Skip to content

Commit

Permalink
close plots properly
Browse files Browse the repository at this point in the history
since plotting method changed to allow figsize, closing plots needs to be shifted to a different mechanism too to make sure pyplot forgets the plot internally.
  • Loading branch information
paulvangentcom committed Mar 20, 2021
1 parent cde39e8 commit 9adb10d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion heartpy/visualizeutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def segment_plotter(working_data, measures, title='Heart Rate Signal Peak Detect
wd_segment['removed_beats_y'] = working_data['removed_beats_y'][i]
wd_segment['hr'] = working_data['hr'][i]
wd_segment['rolling_mean'] = working_data['rolling_mean'][i]
wd_segment['sample_rate'] = working_data['sample_rate'][i]
m_segment['bpm'] = measures['bpm'][i]
try:
wd_segment['rejected_segments'] = working_data['rejected_segments'][i]
Expand All @@ -205,7 +206,7 @@ def segment_plotter(working_data, measures, title='Heart Rate Signal Peak Detect
plt.figure(figsize = figsize)
p = plotter(wd_segment, m_segment, show=False)
p.savefig('%s%i.png' %(path, filenum))
p.close()
plt.close('all')
filenum += 1


Expand Down

0 comments on commit 9adb10d

Please sign in to comment.