# plot.train

##### Plot Method for the train Class

This function takes the output of a `train`

object and creates
a line or level plot using the `lattice`

library.

- Keywords
- hplot

##### Usage

```
## S3 method for class 'train':
plot(x,
plotType = "scatter",
metric = x$perfNames[1],
digits = getOption("digits") - 3,
xTrans = NULL,
...)
```

##### Details

If there are no tuning parameters, or none were varied, an error is produced. If the model has one tuning parameter with multiple candidate values, a plot is produced showing the profile of the results over the parameter. Also, a plot can be produced if there are multiple tuning parameters but only one is varied.

If there are two tuning parameters with different values, a plot can be produced where a different line is shown for each value of of the other parameter. For three parameters, the same line plot is created within conditioning panels of the other parameter.

Also, with two tuning parameters (with different values), a levelplot (i.e. un-clustered heatmap) can be created. For more than two parameters, this plot is created inside conditioning panels.

##### References

Kuhn (2008), ``Building Predictive Models in R Using the caret'' (

##### See Also

##### Examples

```
pamFit <- train(Species ~ .,
data = iris,
"pam",
tuneLength = 15)
plot(pamFit, scales = list(x = list(rot = 90)))
library(klaR)
rdaFit <- train(Species ~ .,
data = iris,
"rda",
control = trainControl(method = "cv"))
plot(rdaFit, plotType = "line")
plot(rdaFit, plotType = "level")
```

*Documentation reproduced from package caret, version 5.07-001, License: GPL-2*