% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/util_plotfunctions.R
\name{plotquantiles}
\alias{plotquantiles}
\title{Plot pairs of quantiles}
\usage{
plotquantiles(
  x,
  y,
  xdomain = NULL,
  alpha.f = 0.25,
  col = palette(),
  border = NA,
  type = "n",
  ...
)
}
\arguments{
\item{x}{Numeric or character: vector of x-coordinates. See \code{\link[=flexiplot]{flexiplot()}}.}

\item{y}{Numeric: a matrix having as many rows as \code{x} and an even number of columns, with one column per quantile. Typically these quantiles have been obtained with \code{\link[=Pr]{Pr()}}, as their \verb{$quantiles} value. This value is a three-dimensional array, and one of its columns (corresponding to the possible values of the \code{X} argument of \code{\link[=Pr]{Pr()}}) or one of its rows (corresponding to the possible values of the \code{Y} argument of \code{\link[=Pr]{Pr()}}) should be selected before being used as \code{y} input.}

\item{xdomain}{Character or numeric or \code{NULL} (default): vector of possible values of the variable represented in the x-axis, if the \code{x} argument is a character vector. The ordering of the values is respected. If \code{NULL}, then \code{unique(x)} is used.}

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

\item{col}{Fill colour of the quantile bands. Can be specified in any of the usual ways, see for instance \code{\link[grDevices:col2rgb]{grDevices::col2rgb()}}. Default \verb{#4477AA}.}

\item{border}{Fill colour of the quantile bands. Can be specified in any of the usual ways, see for instance \code{\link[grDevices:col2rgb]{grDevices::col2rgb()}}. If \code{NA} (default), no border is drawn.}

\item{type}{see analogous argument in \code{\link[=flexiplot]{flexiplot()}}.}

\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{
Utility function to plot pairs of quantiles obtained with \code{\link[=Pr]{Pr()}}.
}
\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 quantiles, setting lower plot range to zero
plotquantiles(x = values, y = probs$quantiles[, 1, ], ylim = c(0, NA),
  xlab = 'bill length', ylab = 'probability')

## add a plot of the probabilities in thick dashed red
flexiplot(x = values, y = probs$values, lwd = 5, lty = 2, col = 2, add = TRUE)

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

\code{\link[=plot.probability]{plot.probability()}} to directly plot posterior probabilities and quantiles contained in a probability object.

\code{\link[=flexiplot]{flexiplot()}} for more general plots.
}
