ããã©ããã¨ãç¶ç¶ããããã«ã¯ããããããªä»æããå¿ è¦ã§ãã
èµ°ãæ £ãã¦ãªãæ¹ãã©ã³ãã³ã°ãç¶ããéã«ãããã©ãæ°æã¡ãæ®ãã ãã§ã¯ç¡ããå·éã«ãã¼ã¿ãè¦ç´ããã¨ã¯æç¨ã§ããApple Watchãç¨ãã¦ã©ã³ãã³ã°ã®çµ±è¨ãã¼ã¿ãéè¨ãã¦ãèªåã«ãã¸ãã£ãã¤ã¡ã¼ã¸ãä½ãæ¹æ³ãå®è·µãã¦ãã¾ãã
ã¢ã©ãã£ãã®ã¡ã¿ãã®ããããããäºåæããèªå® ã¾ã§ã®25kmãèµ°ãããã«èµ°ãç·´ç¿ããã¦ããè¨é²ã§ããèµ°ãå§ãã¦75æ¥ã«ãªãã¾ããã
自動で日数を数える!あなたの進捗ブログに追加すべきJavaScriptコード - 43号線を西へ東へ
ã©ã³ãã³ã°ã®ãã°ãã¼ã¿ãå¯è¦åãã¦ãè¤ããææãæ¢ãã¦ã¯èªåãå±ã¾ãã¦ãã¾ãã
ãããã©ãã¨æãã¦ãã¦ããåãããã¼ã¹ãä¸ãã£ã¦ãããã
ãæã¯é±1ããèµ°ããªãã£ãã®ã«ãä»ã¯é±äºã§èµ°ãã¦ããã
èªåã客観è¦ãã¦è¤ããã¨ããããªãã¤ã¿ã¤ãã¨ããã¦ããã®ã§ãããä»äººæ§ã«è¿·æãããã¦ããããã§ã¯ç¡ãã§ãããç®çéæã®ããã«ã¯æ段ãé¸ã³ã¾ããã
ç¾å¨2.5kmããèµ°ããªãéä½éã®ãããããããã¨6ã¶æå¾ã«25kmèµ°ããã®ã§ãããããèªåã®ããã«ããã¾ãåããããªå¢éã®ããããã«ãããã°åºæ¥ããã¨å¸æãä¸ããããããã«é å¼µãããã¨æãã¾ãã
ç¾å¨ã®ã©ã³ãã³ã°ã®ãããã³ã«
- 20åéèµ°
- å¿ææ°ã®ã³ã³ããã¼ã«
20åéèµ°
ç¾å¨ã¯20åã§èµ°ããè·é¢ãèµ°ã£ã¦ãã¾ãã10åã®ã¿ã¤ãã¼ãããã¦èµ°ã£ã¦ãã¿ã¤ãã¼ããªãã°æ»ã£ã¦ããæ¹æ³ã§ãã
å¿ææ°ã³ã³ããã¼ã«
4æã®éä¸ããå¿ææ°ã¯130ã«ä¸ãããªããããªã¬ãã«ã§èµ°ã£ã¦ãã¾ããããéåã¨æ £ãã¦ãã¾ãããæè¿ã¯å¼å¸ããããµããã¯ãã®å¼µããã¤ããã§ãã
ãè¤ç¾
ææã¯æ°åã§è¡¨ããã¾ããåãããæ©ããé·ãèµ°ãããã¨ããã¬ã¼ãã³ã°ã®å¹æã§ããããè¤ç¾ã§ãã
ãè¤ç¾ãã®1ï¼èµ°è¡è·é¢ã伸ã³ã¦ãã
ææ¯ã®ã°ã©ããªã®ã§ã5æã®å¤ã¯2024å¹´5æ11æ¥ç¾å¨ã®å¤ã«ãªãã¾ãã
æ°´è²ã®æ£ã°ã©ããæéèµ°è¡è·é¢ãã»ã¼æ¯æ¥ï¼é±5ï½6ï¼èµ°ããããã«ãªã£ã¦ãã4æãçªåºãã¦ããã5æã¯11æ¥ç¾å¨ã§4æã®åå以ä¸ã®è·é¢ã¯èµ°è¡æ¸ã¿ãä¸åãããã®è·é¢ã1.9kmãã2.5kmã¨å¾®å¢ã
Pythonã³ã¼ã
import pandas as pd import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties # æ¥æ¬èªãã©ã³ãã®ãã¹ãè¨å® font_path = '***' japanese_font = FontProperties(fname=font_path) # ãã¼ã¿ã®èªã¿è¾¼ã¿ data_path = 'run2024.csv' running_data = pd.read_csv(data_path) # æéåãdatetimeå½¢å¼ã«å¤æãã¦ã¤ã³ããã¯ã¹ã«è¨å® running_data['æé'] = pd.to_datetime(running_data['æé']) running_data.set_index('æé', inplace=True) # ã©ã³ã¿ã¤ã ãç§ããåã«å¤æãã1kmãããã®ãã¼ã¹ãè¨ç® running_data['ã©ã³ã¿ã¤ã (å)'] = running_data['ã©ã³ã¿ã¤ã (ç§)'] / 60 running_data['ãã¼ã¹ (å/km)'] = running_data['ã©ã³ã¿ã¤ã (å)'] / running_data['è·é¢ (km)'] # å¹´æã追å running_data['å¹´æ'] = running_data.index.to_period('M') # æãã¨ã®ãã¼ã¿ãéç´ monthly_data = running_data.groupby('å¹´æ').agg({ 'ãã¼ã¹ (å/km)': 'mean', 'è·é¢ (km)': ['sum', 'count'] }) # æ°ããã«ã©ã åãè¨å® monthly_data.columns = ['æéãã¼ã¹ (å/km)', 'æéç·èµ°è¡è·é¢', 'æéã¯ã¼ã¯ã¢ã¦ãåæ°'] # æéå¹³åèµ°è¡è·é¢ãè¨ç® monthly_data['æéå¹³åèµ°è¡è·é¢'] = monthly_data['æéç·èµ°è¡è·é¢'] / monthly_data['æéã¯ã¼ã¯ã¢ã¦ãåæ°'] # ã°ã©ãã®ä½æ plt.rcParams['font.family'] = japanese_font.get_name() # ã°ãã¼ãã«ã«æ¥æ¬èªãã©ã³ããè¨å® fig, ax1 = plt.subplots(figsize=(16, 9)) # å¹ ã大ãããã # æ£ã°ã©ãã®å¹ è¨å® bar_width = 0.35 # æçªå·ã表示ããã ax1.tick_params(axis='x', labelsize=8) # ã©ãã«ã®ãã©ã³ããµã¤ãºãå°ãããã months = range(len(monthly_data)) bars1 = ax1.bar(months, monthly_data['æéç·èµ°è¡è·é¢'], width=bar_width, color='lightblue', label='æéç·èµ°è¡è·é¢', align='center') bars2 = ax1.bar([x + bar_width for x in months], monthly_data['æéå¹³åèµ°è¡è·é¢'], width=bar_width, color='green', label='æéå¹³åèµ°è¡è·é¢', align='center') # æ°å¤ã®è¿½å for bar in bars1: yval = bar.get_height() ax1.text(bar.get_x() + bar.get_width()/2, yval + 0.5, round(yval, 1), va='bottom', ha='center', fontsize=12, color='black') for bar in bars2: yval = bar.get_height() ax1.text(bar.get_x() + bar.get_width()/2, yval + 0.5, round(yval, 1), va='bottom', ha='center', fontsize=12, color='black') # æåã«ç´ã month_labels = [f'{m+1}æ' for m in monthly_data.index.month - 1] ax1.set_xticks([x + bar_width / 2 for x in months]) ax1.set_xticklabels(month_labels) ax1.set_xlabel('æ', fontproperties=japanese_font) ax1.set_ylabel('èµ°è¡è·é¢ (km)', fontproperties=japanese_font) ax1.tick_params(axis='y') # ãã¼ã¹ã®ããããï¼å³è»¸ï¼ ax2 = ax1.twinx() ax2.set_ylabel('æéãã¼ã¹ (å/km)', fontproperties=japanese_font) ax2.plot(months, monthly_data['æéãã¼ã¹ (å/km)'], color='red', label='æéãã¼ã¹ (å/km)') ax2.tick_params(axis='y', labelcolor='red') # å¡ä¾ã¨ã¿ã¤ãã« fig.legend(loc='upper left', bbox_to_anchor=(0.1, 0.9), prop=japanese_font) plt.title('å¹´æå¥ ã©ã³ãã³ã°ããã©ã¼ãã³ã¹', fontproperties=japanese_font) plt.show()
ãè¤ç¾ãã®2ï¼ãã¼ã¹ãéããªã£ã¦ããã®ã«å¿ææ°ã¯æ大ã»å¹³åã¨ãæ¸å°
Pythonã³ã¼ã
import pandas as pd import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties # ãã¼ã¿ã®èªã¿è¾¼ã¿ data_path = '***' running_data = pd.read_csv(data_path) # æéåãdatetimeå½¢å¼ã«å¤æãã¦ã¤ã³ããã¯ã¹ã«è¨å® running_data['æé'] = pd.to_datetime(running_data['æé']) running_data.set_index('æé', inplace=True) # ã©ã³ã¿ã¤ã ãç§ããåã«å¤æãã1kmãããã®ãã¼ã¹ãè¨ç® running_data['ã©ã³ã¿ã¤ã (å)'] = running_data['ã©ã³ã¿ã¤ã (ç§)'] / 60 running_data['ãã¼ã¹ (å/km)'] = running_data['ã©ã³ã¿ã¤ã (å)'] / running_data['è·é¢ (km)'] # æã追å running_data['æ'] = running_data.index.month # æãã¨ã®ãã¼ã¿ãéç´ monthly_data = running_data.groupby('æ').agg({ 'ãã¼ã¹ (å/km)': 'mean', 'æé«å¿ææ° (bpm)': 'max', 'å¹³åå¿ææ° (bpm)': 'mean' }) # æ¥æ¬èªãã©ã³ãã®è¨å® font_path = '***' japanese_font = FontProperties(fname=font_path) # ã°ã©ãã®ä½æ fig, ax1 = plt.subplots(figsize=(10, 6)) # å¿ææ°ã®æ£ã°ã©ãï¼å·¦è»¸ï¼ width = 0.35 # æ£ã°ã©ãã®å¹ bars1 = ax1.bar(monthly_data.index - width/2, monthly_data['å¹³åå¿ææ° (bpm)'], width=width, color='#92a1cf', label='å¹³åå¿ææ°') # Muted blue bars2 = ax1.bar(monthly_data.index + width/2, monthly_data['æé«å¿ææ° (bpm)'], width=width, color='#d95f02', label='æ大å¿ææ°') # Muted orange ax1.set_xlabel('æ', fontproperties=japanese_font) ax1.set_ylabel('å¿ææ° (bpm)', color='black', fontproperties=japanese_font) ax1.tick_params(axis='y') ax1.set_xticks(range(1, 13)) # X軸ã®ç®çãã1æãã12æã¾ã§ã®æ´æ°ã«è¨å® ax1.grid(True) ax1.set_ylim(110, None) # æå°å¤ã100ã«è¨å® # ãã¼ã«å¤ã表示ãã for bar in bars1: yval = bar.get_height() ax1.text(bar.get_x() + bar.get_width()/2, yval, round(yval, 1), ha='center', va='bottom', fontsize=12) for bar in bars2: yval = bar.get_height() ax1.text(bar.get_x() + bar.get_width()/2, yval, round(yval, 1), ha='center', va='bottom', fontsize=12) # ãã¼ã¹ã®ããããï¼å³è»¸ï¼ ax2 = ax1.twinx() ax2.plot(monthly_data.index, monthly_data['ãã¼ã¹ (å/km)'], color='#7570b3', marker='o', label='å¹³åãã¼ã¹') # Muted purple ax2.set_ylabel('ãã¼ã¹ (å/km)', color='#7570b3', fontproperties=japanese_font) ax2.tick_params(axis='y', labelcolor='#7570b3') # å¡ä¾ã®è¿½å ããã©ã³ãããããã£é©ç¨ fig.legend(loc='upper left', bbox_to_anchor=(0.1, 0.9), prop=japanese_font) plt.title('æå¥ã©ã³ãã³ã°ããã©ã¼ãã³ã¹', fontproperties=japanese_font) plt.show()
表形å¼
å¹´æ | ã©ã³ãã³ã°åæ° | åè¨èµ°è¡è·é¢ | å¹³åèµ°è¡è·é¢ | å¹³åãã¼ã¹ | å¹³åå¿ææ° (bpm) |
---|---|---|---|---|---|
2024-02 | 1 | 1.09 | 1.09 | 8:14 | 128 |
2024-03 | 3 | 5.56 | 1.85333 | 9:20 | 128 |
2024-04 | 17 | 32.26 | 1.89765 | 8:46 | 126.412 |
2024-05 | 8 | 19.99 | 2.49875 | 8:29 | 125.125 |
使ç¨ãã¦ãããã¼ã¿å½¢å¼
Apple Watchã§æ¸¬å®ããã©ã³ãã³ã°ãã¼ã¿ããiPhoneã®ã¢ããªRummeterã«ã¤ã³ãã¼ããã¦ãããã©ã³ãã³ã°ã®ãµããªã¼ãã¼ã¿ãCSVå½¢å¼ã§ã¨ã¯ã¹ãã¼ããã¦ãã¾ãã
Apple Watchã®ã©ã³ãã³ã°ãã¼ã¿ãCSVã§æ¸ãåºããæ¹æ³ãåããã°ãå¤æ´ããäºå®ã§ãã
使ç¨ãã¦ãããã¼ã¿ï¼CSVå½¢å¼ï¼
åå,æé,ã©ã³ã¿ã¤ã ,ã©ã³ã¿ã¤ã (ç§),åæ¢æé,åæ¢æé (ç§),緯度,çµåº¦,é«åº¦ (ã¡ã¼ãã«),è·é¢ (km),å¹³åã¹ãã¼ã (km/æ),å¹³åãã¼ã¹,å¹³åãã¼ã¹ (ç§),æé«ã¹ãã¼ã (km/æ),æé«ãã¼ã¹,æé«ãã¼ã¹ (ç§),ç»ã (ã¡ã¼ãã«),éã (ã¡ã¼ãã«),ã«ããªã¼,æ©æ°,æ大æ©æ°ãã¼ã¹ (æ©æ°/å),å¹³åæ©æ°ãã¼ã¹ (æ©æ°/å),æé«å¿ææ° (bpm),å¹³åå¿ææ° (bpm),åè¨ã©ã³ã¿ã¤ã ,åè¨ã©ã³ã¿ã¤ã (ç§),åè¨è·é¢ (km) ,2024-02-27 05:50:20,0:08:59,539.3,0:00:00,0.0,0.0,0.0,0,1.09,7.28,0:08:14,494,8.68,0:06:55,415,0,0,97,1215,164,135,143,128,0:08:59,539.3,1.09
ãè¤ç¾ãã®3ï¼Apple Watchã®ããã¸
iPhoneã®ãã£ãããã¹ã¢ããªå ã®ãã°ã§é·ãèµ°ã£ãããã«ããªã¼ãæ¶è²»ãããããã¨ããã¸ãä»ä¸ããã¾ããããã¸ãéãã¦ããã¤ã³ãã貯ã¾ãããã§ãããã¾ãããèµ°ã£ã¦ããªãã¨ãã¯ãã ãããªã«ï¼ãã¨ããç®ã§è¦ã¦ãã¾ããããä»ã¯ããã¸ã®ä»ä¸ãç´ ç´ã«åã³æ¥½ããã§ãã¾ãã
æå¾ã«
4æã«ã¯æ¯æ¥èµ°ããã¨æã£ã¦ãã¾ããããå³ãµããã¯ãã®å¼µããã ãã ãå¢ãã¦ãã¾ããã5æã¯ä¼æ©å ¥ããªããé±5ï½6æ¥ã®ãã¼ã¹ã§èµ°ã£ã¦ãã¾ãã
ã°ã©ãã®éããæéã®èµ°ãè·é¢ã¯å¢å ããã©ã³ãã³ã°ãã¼ã¹ãæåããã¯éããªã£ã¦ãããã®ã®ãå¿ææ°ã¯ä¸ããã«ãããªã£ã¦ãã¾ãã
å¿èºæ©è½ï¼èºããã³ç´°èå ã®ã¬ã¹äº¤æè½ï¼ã復活ãã¦ããã¨è¨ããã¨ã§ãããã
é«æ ¡æ代ããã®å¤å·ã¢ãã¬ã¹è ±ã®çã¿ãå ¨ãåºãªãã®ã¯ããããç¶æ³ã§ãããã ããµããã¯ãã®å¼µãã¨ã¢ãã¬ã¹è ±çã®é¢é£æ§ã¯é«ãã®ã§ãèµ°ãé »åº¦ãè·é¢ãçãã¬ã®å°å ¥ãªã©ããããããã£ã¦ãããä»ã®10åã®è·é¢ãèµ°ããããã«ãªãããã¨æãã¾ãã
ä½è« ãªããªãã復帰
ãªããªãããã³ã³ã復活ãã¦ããããã±ã®ãªã¼ããã³ã°ã®ã¼ããããããããªããªãã«ããä½æ°ã«ããããã§ãã復帰ããã§ã¨ããããã¾ãã