Draws a plot of the marginal posterior density for a single parameter, with an option to add the mean and the credible interval at the desired level
marginal_plot(
data,
position = 1,
level = 0.95,
grid_length = 1024,
title = if (is.numeric(position)) names(data)[position] else position,
subtitle = "Marginal posterior density",
caption = paste(level * 100, "% credible interval", sep = ""),
x_label = "Calendar year",
y_label = "Density",
y_grid = TRUE,
x_scale = "calendar",
elapsed_origin_position = NULL,
x_min = NULL,
x_max = NULL,
height = 7,
width = 7,
units = "in",
file = NULL,
plot_result = TRUE,
mean_linetype = "dashed",
mean_color = "white",
mean_size = 0.5,
ci_linetype = "dotted",
ci_color = mean_color,
ci_size = mean_size,
line_linetype = "solid",
line_color = "black",
line_size = 1,
density_color = "gray30",
fill_palette = NULL
)
Data frame containing the output of the MCMC algorithm.
Index of the column corresponding to the MCMC chain of interest, or a column name.
Probability corresponding to the level of confidence.
Length of the grid used to estimate the density.
Title of the graph. The default uses the data
column name.
Subtitle of the graph. The default is "Marginal posterior density".
Caption of the graph. The default describes the confidence of the credible interval.
Label of the x-axis.
Label of the y-axis.
Switch for horizontal grid lines.
One of "calendar" for calendar years, "BP" for years before present, or "elapsed" for time elapsed from a specified origin.
Position of the column to use as the origin for elapsed time calculations.
Minimum x axis value.
Maximum x axis value.
Plot height in units
.
Plot width in units
.
String recognized by the ggsave()
function,
one of "in", "cm", "mm". This parameter has no effect on the
display plot.
Name of the file that will be saved if chosen,
default = NULL
.
If TRUE
, then draw a plot on the display,
else suppress drawing.
The linetype
used to indicate the mean density.
The color of the line used to indicate mean density.
The width of the line used to indicate the mean density.
The linetype
used to indicate the credible
intervals.
The color of the lines used to indicate the credible intervals.
The width of the lines used to indicate the credible intervals.
The linetype
used to indicate the density.
The color of the line used to indicate the density.
The width of the line used to indicate the density.
Color to use if fill_palette is not specified.
Palette to use for fills.
An archaeophases_plot
object with the data and metadata
needed to reproduce the plot.
The plot is drawn with the current theme and color scales; the function does not alter or override theme elements.
# NOT RUN {
data(Events)
mp <- marginal_plot(data = Events, position = 2, level = 0.95)
## View data and metadata
str(mp)
# }
Run the code above in your browser using DataLab