Visualizes the relationship between Acute and Chronic Training Load.
Usage
plot_exposure(
stoken,
activity_type = c("Run", "Ride", "VirtualRide", "VirtualRun"),
load_metric = "duration_mins",
acute_period = 7,
chronic_period = 42,
user_ftp = NULL,
user_max_hr = NULL,
user_resting_hr = NULL,
end_date = NULL,
risk_zones = TRUE,
exposure_df = NULL
)
Arguments
- stoken
A valid Strava token from `rStrava::strava_oauth()`. Required unless `exposure_df` is provided.
- activity_type
Type(s) of activities to include (e.g., "Run", "Ride"). Default uses common types.
- load_metric
Method for calculating daily load (e.g., "duration_mins", "tss", "hrss"). Default "duration_mins". See `calculate_exposure` for details on approximate TSS/HRSS calculations.
- acute_period
Days for acute load window (e.g., 7).
- chronic_period
Days for chronic load window (e.g., 42). Must be > `acute_period`.
- user_ftp
Required if `load_metric = "tss"`. Your FTP.
- user_max_hr
Required if `load_metric = "hrss"`. Your max HR.
- user_resting_hr
Required if `load_metric = "hrss"`. Your resting HR.
- end_date
Optional. Analysis end date (YYYY-MM-DD string or Date). Defaults to today.
- risk_zones
Add background shading for typical ACWR risk zones? Default `TRUE`.
- exposure_df
Optional. A pre-calculated data frame from `calculate_exposure`. If provided, `stoken` and other calculation parameters are ignored. Must contain `date`, `atl`, `ctl` (and `acwr` if `risk_zones = TRUE`).
Details
Plots ATL vs CTL, optionally showing risk zones based on ACWR. Uses pre-calculated data or calls `calculate_exposure`.
Visualizes training state by plotting ATL vs CTL (related to PMC charts). Points are colored by date, latest point is highlighted (red triangle). Optional risk zones (based on ACWR thresholds ~0.8, 1.3, 1.5) can be shaded. If `exposure_df` is not provided, it calls `calculate_exposure` first.
Examples
# 使用模拟数据示例
data(Athlytics_sample_data)
if (!is.null(athlytics_sample_exposure)) {
p <- plot_exposure(exposure_df = athlytics_sample_exposure)
print(p)
}
#> Generating plot...
# \donttest{
# 使用真实数据的示例(需要认证)
stoken <- rStrava::strava_oauth(..., cache = TRUE)
#> Error: '...' used in an incorrect context
# 绘制默认活动的exposure图 (使用运动时长)
plot_exposure(stoken = stoken)
#> Error: object 'stoken' not found
# 绘制骑行的exposure图 (使用TSS, 7/28天周期)
plot_exposure(stoken = stoken, activity_type = "Ride", load_metric = "tss",
user_ftp = 280, acute_period = 7, chronic_period = 28)
#> Error: object 'stoken' not found
# 绘制跑步的exposure图 (使用HRSS)
plot_exposure(stoken = stoken, activity_type = "Run", load_metric = "hrss",
user_max_hr = 190, user_resting_hr = 50)
#> Error: object 'stoken' not found
# }