% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/util_plotfunctions.R
\name{plot.probability}
\alias{plot.probability}
\title{Plot an object of class "probability"}
\usage{
\method{plot}{probability}(
  x,
  variability = NULL,
  subset = NULL,
  PvsY = NULL,
  legend = "top",
  lty = c(1, 2, 4, 3, 6, 5),
  lwd = 2,
  col = palette(),
  type = NULL,
  alpha.f = 1,
  var.alpha.f = NULL,
  xlab = NULL,
  ylab = NULL,
  main = NULL,
  ylim = c(0, NA),
  grid = TRUE,
  add = FALSE,
  ...
)
}
\arguments{
\item{x}{Object of class "probability", obtained with \code{\link[=Pr]{Pr()}}.}

\item{variability}{One of the values \code{'quantiles'}, \code{'samples'}, \code{'none'} (equivalent to \code{NA} or \code{FALSE}), or \code{NULL} (default), in which case the variability available in \code{p} is used. This argument chooses how to represent the variability of the probability; see \code{\link[=Pr]{Pr()}}. If the requested variability is not available in the object \code{p}, then a warning is issued and no variability is plotted.}

\item{subset}{Named list or named vector: which variate values to display. For the variates corresponding to the names in this list, only the vector of values corresponding to that variate is displayed.}

\item{PvsY}{Logical or \code{NULL}: should probabilities be plotted against their \code{Y} argument? If \code{NULL}, the argument between \code{Y} and \code{X} having larger number of values is chosen. As many probability curves will be plotted as the number of values of the other argument.}

\item{legend}{One of the values \code{'bottomright'}, \code{'bottom'}, \code{'bottomleft'}, \code{'left'}, \code{'topleft'}, \code{'top'}, \code{'topright'}, \code{'right'}, \code{'center'} (see \code{\link[graphics:legend]{graphics::legend()}}): plot a legend at that position. A value \code{FALSE} or any other does not plot any legend. Default \code{'top'}.}

\item{lty, lwd, col, type, xlab, ylab, main, ylim, grid, add}{see analogous arguments in \code{\link[graphics:matplot]{graphics::matplot()}}}

\item{alpha.f}{Numeric, default 0.25: opacity of the colours, \code{0} being completely invisible and \code{1} completely opaque.}

\item{var.alpha.f}{Numeric: opacity of the quantile bands or of the samples, \code{0} being completely invisible and \code{1} completely opaque.}

\item{...}{Other parameters to be passed to \code{\link[=flexiplot]{flexiplot()}}.}
}
\value{
\code{NULL}, \link[base:invisible]{invisibly}; produces a plot, see \code{\link[graphics:matplot]{graphics::matplot()}}.
}
\description{
This \code{\link[base:plot]{base::plot()}} method is a utility to plot probabilities obtained with \code{\link[=Pr]{Pr()}}, as well as their variabilities. The probabilities are plotted either against \code{Y}, with one curve for each value of \code{X}, or vice versa.
}
\examples{
## Load the example `learnt` object calculated from the "penguins" dataset;
## variates: 'species' and 'bill_len'
learnt <- learntExample

## create a grid of values for variate "bill length",
## based on the information in the dataset and metadata:
values <- vrtgrid(vrt = 'bill_len', learnt = learnt)

## calculate the probabilities and quantiles
probs <- Pr(Y = data.frame(bill_len = values), learnt = learnt, parallel = 1)

## plot the probabilities and quantiles
plot(probs)

}
\seealso{
\code{\link[=Pr]{Pr()}} to calculate posterior probabilities and quantiles.

\code{\link[=hist.probability]{hist.probability()}} to plot the variability of the probabilities as a distribution.

\code{\link[=flexiplot]{flexiplot()}} (on which \code{plot.probability()} is based) for more general plots.

\code{\link[=plotquantiles]{plotquantiles()}} to plot quantile ranges.
}
