R: Plot functions for the Functional Data

plot.functional {ddalpha} | R Documentation

## Plot functions for the Functional Data

### Description

Plots the functional data given in the form which is described in the topic `dataf.*`.

### Usage

    ## S3 method for class 'functional'
    plot(x,
          main = "Functional data", xlab = "args", ylab = "vals",
          colors = c("red", "blue", "green", "black", "orange", "pink"), ...)

    ## S3 method for class 'functional'
    lines(x,
          colors = c("red", "blue", "green", "black", "orange", "pink"), ...)

    ## S3 method for class 'functional'
    points(x,
          colors = c("red", "blue", "green", "black", "orange", "pink"), ...)

### Arguments

`x` | The functional data as in the topic `dataf.*`. Note, that the in order to use s3 methods the data must be of class "functional".
`main` | an overall title for the plot: see `title`
`xlab` | a title for the x axis: see `title`
`ylab` | a title for the y axis: see `title`
`colors` | the colors for the classes of the data. The colors are applied to the classes sorted in alphabetical order. Use the same set of classes to ensure that the same colours are selected in `lines` and `points` as in `plot` (do not remove entire classes).
`...` | additional parameters

### See Also

`dataf.*` for functional data description

### Examples

    ## Not run:
      ## load the Growth dataset
      dataf = dataf.growth()

      labels = unlist(dataf$labels)
      plot(dataf,
           main = paste("Growth: girls red (", sum(labels == "girl"), "),",
                        " boys blue (", sum(labels == "boy"), ")", sep=""),
           xlab="Year", ylab="Height, cm",
           colors = c("blue", "red")   # in alphabetical order of class labels
      )

      # plot an observation as a line
      observation = structure(list(dataf = list(dataf$dataf[[1]])), class = "functional")
      lines(observation, colors = "green", lwd = 3)

      # plot hight at the age of 14
      indexAge14 = which(observation$dataf[[1]]$args == 14)
      hightAge14 = observation$dataf[[1]]$vals[indexAge14]
      atAge14 = structure(list(
                          dataf = list(dataf = list(args = 14, vals = hightAge14))
                          ), class = "functional")
      points(atAge14, colors = "yellow", pch = 18)

    ## End(Not run)

[Package ddalpha version 1.3.11 Index]