This function plots stratigraphic data either as polygons or bars.
plot_diagram(
x,
bars = FALSE,
col = "black",
amplif = 5,
save = FALSE,
filename = "Diagram.pdf",
width = 3.54,
height = 9,
as.png = FALSE,
png.res = 300,
yax_incr = 5,
bar_width = diff(range(x$inputs$x))/length(x$inputs$x),
xlim = NA,
tickAtSample = TRUE,
col_pos = "black",
col_neg = "grey80",
title = NA,
src = NA
)
A data frame of the data to plot (first column with age or depth)
and the taxa in the following columns. x can also be a
crestObj
.
A boolean that indicates if the data should be plotted as polygons
(default: bars=FALSE
) or vertical bars (bars=TRUE
).
Colours to be used for the polygons. If the number of colours does not match the number of taxa, colors will be recycled.
A factor the show exaggeration on the diagram. Only for polygon plot. Default 5.
A boolean to indicate if the diagram should be saved as a pdf file.
Default is FALSE
.
An absolute or relative path that indicates where the diagram
should be saved. Also used to specify the name of the file. Default:
the file is saved in the working directory under the name
'Diagram.pdf'
.
The width of the output file in inches (default 3.54in ~ 9cm).
The height of the output file in inches (default 9in ~ 23cm).
A boolean to indicate if the output should be saved as a png.
Default is FALSE
and the figure is saved as a pdf file.
The resolution of the png file (default 300 pixels per inch).
Graphical parameters describing the increment size on the y-axis (default 5).
Width of the bars of the barplot (default 1/50th of the x range).
The range covered by the x-axis. Can be adjusted to get round numbers on the x-axis. If smaller than the range covered by the data, the data will be truncated (default: range of the data).
Boolean that indicates whether a tick mark should be added
on the x-axis at the location of each sample (default TRUE
).
Graphical parameter for the barplot. Colour of all the positive values (default black).
Graphical parameter for the barplot. Colour of all the negative values (default light grey).
Name to be added on top of the plot (default NA
).
A graphical parameter used by the plot_loo()
function.
No return value, this function is used to plot.
data(crest_ex)
plot_diagram(crest_ex, bars=TRUE, col='black', bar_width=0.8)
plot_diagram(crest_ex, col=1:7, tickAtSample=FALSE)
#> Replace 'tempdir()' by the location where the sample should be saved (e.g. 'getwd()')
plot_diagram(crest_ex, save=TRUE,
filename=file.path(tempdir(), 'testDiagram.pdf'),
bars=TRUE, col_pos='cornflowerblue', col_neg='darkgreen',
bar_width=0.8, xlim=c(3,15))