#' Plots a line with the confidence intervals as arrows
#'
#' This function plots a line and the lower and upper limits of the conficende interval for each point.
#' It can be used to plot the curves generated by 'conservation_value_seq_CI'.
#' @param x A matrix with 3 columns. Each row represents one point. The 1st columns contains the point value, while the 2nd and 3rd contain the lower and upper limits of the confidence interval, respectively.
#' @export
#' @importFrom graphics arrows plot
#' @examples
#' data(community_data)
#'
#' #Select all samples in Evironment 'A'
#' comm.A<-community_data[which(community_data$environment == "A"),]
#'
#' # Select only the abundance matrix (columns 1 and 2 contain the 'environment' and 'sample' data)
#' comm.A <- comm.A[, 3:ncol(comm.A)]
#'
#' #Select all samples in Evironment 'B'
#' comm.B<-community_data[which(community_data$environment == "B"),]
#'
#' # Select only the abundance matrix (columns 1 and 2 contain the 'environment' and 'sample' data)
#' comm.B <- comm.B[, 3:ncol(comm.B)]
#'
#' Create 30 bootstrapped communities for each of the two original communities (comm.A and comm.B)
#' x_boot<-bootstrap(comm.A, 30)
#' y_boot<-bootstrap(comm.B, 30)
#'
#' # Sequentially remove abundance classes from both communities and calculate the m3 conservation metric with 95% confidence intervals
# 'm3<- conservation_value_seq_CI(x.boot, y.boot, 5)$m3
#'
#' #Plot the m3 metric with confidence intervals
#' plot_graph_CI(m3)
plot_graph_CI<-function(x){
plot(x[1:nrow(x),1], type="b",ylim=c(0,1))
arrows(1:nrow(x),x[1:nrow(x),2],1:nrow(x),x[1:nrow(x),3],code=3,angle=90,length=0.1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.