This base::plot() method is a utility to plot probabilities obtained with Pr(), as well as their revisabilities. The probabilities are plotted either against Y, with one curve for each value of X, or vice versa.
Usage
# S3 method for class 'probability'
plot(
x,
spread = NULL,
subset = NULL,
PvsY = NULL,
legend = "topright",
type = NULL,
lty = c(1, 2, 4, 3, 6, 5),
pch = c(1, 2, 0, 5, 6, 3),
lwd = 2,
col = palette(),
xlab = NULL,
ylab = NULL,
xlim = NULL,
ylim = c(0, NA),
add = FALSE,
alpha.f = 1,
grid = TRUE,
lwd.grid = NULL,
col.grid = "#00000022",
axes = FALSE,
ylab2 = NULL,
main = NULL,
type.spread = NULL,
lty.spread = c(1, 2, 4, 3, 6, 5),
lwd.spread = NULL,
alpha.f.spread = NULL,
nsamples.spread = 360,
...
)Arguments
- x
Object of class "probability", obtained with
Pr().- spread
One of the values
'quantiles','samples','none'(equivalent toNAorFALSE), orNULL(default), in which case the revisability available inpis used. This argument chooses how to represent the revisability of the probability; seePr(). If the requested representation is not available in the objectx, then a warning is issued and no revisability is plotted.- 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.
- PvsY
Logical or
NULL: should probabilities be plotted against theirYargument? IfNULL, the argument betweenYandXhaving larger number of values is chosen. As many probability curves will be plotted as the number of values of the other argument.- legend
One of the values
'bottomright','bottom','bottomleft','left','topleft','top','topright','right','center'(seegraphics::legend()): plot a legend at that position. A valueFALSEor any other does not plot any legend. Default'top'.- type
NULL(default) or character vector or indicating the type of plot for the main probability distribution; seebase::plot(). The defaultNULLvalue uses type'l'(lines) for continuous variates, and'b'(points and lines) for discrete variates.- lty
Analogous to argument
lty(line style) ingraphics::matplot(), used for the main probability distributions.- pch, col, xlab, ylab, main, xlim, ylim, grid, axes, add, lwd.grid, col.grid
see analogous arguments in
graphics::plot.default()andgraphics::matplot().- lwd
Analogous to argument
lwd(line width) ingraphics::matplot(), used for the main probability distributions.- alpha.f
Numeric, default
1: opacity of the colours of lines or markers,0being completely invisible and1completely opaque.- ylab2
A title for the y-axis on the right side of the plot, if displayed.
- type.spread
NULL(default) or character vector or indicating the type of plot for the long-run-frequency samples; see. The defaultNULLvalue uses type'l'(lines) for continuous variates, and'b'(points and lines) for discrete variates.- lty.spread
Same as parameter
lty(line style), but for the line type of the long-run-frequency samples.- lwd.spread
Same as parameter
lwd(line width), but for the line type of the long-run-frequency samples.- alpha.f.spread
Numeric or
NULL(default): opacity of the quantile bands or of the long-run-frequency samples, similar toalpha.f.NULLmeans1ifspread = 'samples'and0.25ifspread = 'quantiles'.- nsamples.spread
Integer, default 360: number of samples of long-run frequencies to display.
- ...
Other parameters to be passed to
pplot().
Value
NULL, invisibly; produces a plot, see graphics::matplot().
See also
Pr() to calculate posterior probabilities and quantiles.
hist.probability() to plot the revisability of the probabilities as a distribution.
pplot() (on which plot.probability() is based) for more general plots.
Examples
## Load the example `K`nowledge object calculated from the "penguins" dataset;
## variates: 'species' and 'bill_len'
K <- Kexample
## create a grid of values for variate "bill length",
## based on the information in the dataset and metadata:
valuesBill <- vrtgrid(vrt = 'bill_len', K = K)
## calculate the probabilities and quantiles
probs <- Pr(Y = valuesBill, K = K)
## plot the probabilities and quantiles
plot(probs)