plot_metrics: Plot of cycling metrics.

Description Usage Arguments Value Author(s) Examples

View source: R/plot_metrics.R

Description

It generates the plot for the 3 metrics calculated using the function metrics_moving_avg.

Usage

1
plot_metrics(dates_list, pmax_all = NULL, wbal_all = NULL, mftp_all = NULL, period = 90)

Arguments

dates_list

A vector containing all dates and times from every training session. It's good to use with get_power_data() within Golden Cheetah.

pmax_all

The maximum power estimation for each 90-day period, in watts. It's the output of metrics_moving_avg.

wbal_all

The anaerobic capacity estimations for each 90-day period, in Joules. It's the output of metrics_moving_avg.

mftp_all

The modeled functional threshold power estimation for each 90-day period, in watts. It's the output of metrics_moving_avg.

period

The period of days to calculate the moving average. The default is 90 days as in function metrics_moving_avg.

Value

It prints 3 plots about the metrics PMax, WBal and mFTP, for each date between the first and last dates in dates_list.

Author(s)

Natan Freitas Leite.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## The function is currently defined as
function (dates_list, pmax_all = NULL, wbal_all = NULL, mftp_all = NULL,
    period = 90)
{
    if (length(pmax_all) != 0) {
        plot(seq(dates_list[1] + period, tail(dates_list, 1),
            length.out = length(pmax_all)), pmax_all, type = "l",
            lwd = 2, col = "purple", xaxt = "n", main = paste("PMax: Rolling",
                period, "days"), xlab = "Date", ylab = "Watts")
        axis(side = 1, at = seq(dates_list[1] + period, tail(dates_list,
            1), length.out = 8), labels = format(seq(dates_list[1] +
            period, tail(dates_list, 1), length.out = 8), "%b-%y"))
        abline(v = seq(dates_list[1] + period, tail(dates_list,
            1), length.out = 8), col = "grey", lwd = 0.5, lty = "dotted")
        grid(NA, NULL)
    }
    if (length(wbal_all) != 0) {
        plot(seq(dates_list[1] + period, tail(dates_list, 1),
            length.out = length(wbal_all)), wbal_all, type = "l",
            lwd = 2, col = "orange", xaxt = "n", main = paste("W': Rolling",
                period, "days"), xlab = "Date", ylab = "Joules")
        axis(side = 1, at = seq(dates_list[1] + period, tail(dates_list,
            1), length.out = 8), labels = format(seq(dates_list[1] +
            period, tail(dates_list, 1), length.out = 8), "%b-%y"))
        abline(v = seq(dates_list[1] + period, tail(dates_list,
            1), length.out = 8), col = "grey", lwd = 0.5, lty = "dotted")
        grid(NA, NULL)
    }
    if (length(mftp_all) != 0) {
        plot(seq(dates_list[1] + period, tail(dates_list, 1),
            length.out = length(mftp_all)), mftp_all, type = "l",
            lwd = 2, col = "red", xaxt = "n", main = paste("Modeled FTP: Rolling",
                period, "days"), xlab = "Date", ylab = "Watts")
        axis(side = 1, at = seq(dates_list[1] + period, tail(dates_list,
            1), length.out = 8), labels = format(seq(dates_list[1] +
            period, tail(dates_list, 1), length.out = 8), "%b-%y"))
        abline(v = seq(dates_list[1] + period, tail(dates_list,
            1), length.out = 8), col = "grey", lwd = 0.5, lty = "dotted")
        grid(NA, NULL)
    }
  }

  data(metrics)

  par(mfrow=c(1,3))
  plot_metrics(dates_list_updt,metrics[[1]],metrics[[2]],metrics[[3]])

Bolshom/optimumtt documentation built on May 24, 2019, 8:56 a.m.