Skip to content

Commit 305eb44

Browse files
authored
Merge pull request #29 from hunminkim98/main
prevent error for plot when using mac
2 parents b55ea92 + 1bd3366 commit 305eb44

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Sports2D/process.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import shutil
6161
import os
6262
import re
63+
import platform
6364
from importlib.metadata import version
6465
from datetime import datetime
6566
import itertools as it
@@ -788,18 +789,23 @@ def pose_plots(trc_data_unfiltered, trc_data, person_id):
788789
OUTPUT:
789790
- matplotlib window with tabbed figures for each keypoint
790791
'''
791-
792-
mpl.use('qt5agg')
792+
os_name = platform.system()
793+
794+
if os_name == 'Windows':
795+
mpl.use('qt5agg') # windows
793796
mpl.rc('figure', max_open_warning=0)
794797

795798
keypoints_names = trc_data.columns[1::3]
796-
799+
797800
pw = plotWindow()
798801
pw.MainWindow.setWindowTitle('Person'+ str(person_id) + ' coordinates') # Main title
799802

800803
for id, keypoint in enumerate(keypoints_names):
801804
f = plt.figure()
802-
f.canvas.manager.window.setWindowTitle(keypoint + ' Plot')
805+
if os_name == 'Windows':
806+
f.canvas.manager.window.setWindowTitle(keypoint + ' Plot') # windows
807+
elif os_name == 'Darwin': # macOS
808+
f.canvas.manager.set_window_title(keypoint + ' Plot') # mac
803809

804810
axX = plt.subplot(211)
805811
plt.plot(trc_data_unfiltered.iloc[:,0], trc_data_unfiltered.iloc[:,id*3+1], label='unfiltered')

0 commit comments

Comments
 (0)