plot.curve_set | R Documentation |
Plot method for the class 'curve_set'
## S3 method for class 'curve_set'
plot(x, idx, col_idx, idx_name = "", col = "grey70", ...)
x |
An |
idx |
Indices of functions to highlight with color |
col_idx |
A color for the curves to highlight, or a vector of the same length as |
idx_name |
A variable name to be printed with the highlighted functions' idx. Default to empty. |
col |
The basic color for the curves (which are not highlighted). |
... |
Ignored. |
create_curve_set
cset <- curve_set(r = 1:10, obs = matrix(runif(10*5), ncol=5))
plot(cset)
# Highlight some functions
plot(cset, idx=c(1,3))
plot(cset, idx=c(1,3), col_idx=c("black", "red"))
# Change legend
plot(cset, idx=c(1,3), col_idx=c("black", "red"), idx_name="Special functions")
plot(cset, idx=c(1,3)) + ggplot2::theme(legend.position="bottom")
# Add labels
plot(cset, idx=c(1,3)) + ggplot2::labs(x="x", y="Value")
# and title
plot(cset) + ggplot2::labs(title="Example curves", x="x", y="Value")
# A curve_set with one observed function (other simulated)
if(requireNamespace("mvtnorm", quietly=TRUE)) {
cset <- curve_set(obs = c(-1.6, 1.6),
sim = t(mvtnorm::rmvnorm(200, c(0,0), matrix(c(1,0.5,0.5,1), 2, 2))))
plot(cset)
# Remove legend
plot(cset) + ggplot2::theme(legend.position="none")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.