plotTH <- function(x, AUC = TRUE, devCI = 0.05, xlab = "Gradient", psize = 0, range = TRUE, log = FALSE){
if(devCI < 0 | devCI > 0.5)
{stop("devCI needs to similar or in between 0 and 0.5.")}
dfi <- x[is.finite(x$Response),]
if(AUC == F)
{df <- dfi}
else if(AUC == T){
dfp <- dfi[dfi$`LCI(a)` >= 0.5+devCI & dfi$`HCI(a)` >= 0.5+devCI,]
dfn <- dfi[dfi$`LCI(a)` <= 0.5-devCI & dfi$`HCI(a)` <= 0.5-devCI,]
df <- rbind.data.frame(dfp, dfn)}
else{stop("Argument for AUC has to be either TRUE or FALSE.")}
if(range == T)
{range <- ggplot2::geom_errorbarh(ggplot2::aes(xmin = min, xmax = max), height = 0, linetype = "dotted")}
else if(range == F)
{range <- NULL}
else{stop("Argument for range has to be either TRUE or FALSE")}
if(log == T)
{log <- ggplot2::scale_x_log10()}
else if(log == F)
{log <- NULL}
else{stop("Argument for log has to be either TRUE or FALSE")}
if(nrow(df) == 0){stop("No taxa are displayed. Selected devCI is too high or responses are weak.")}
ggplot2::ggplot(df, ggplot2::aes(x=Threshold, y=reorder(paste(Taxon, paste0("n=", round(df$n,0))), -Threshold)))+
ggplot2::xlab(xlab)+ggplot2::ylab("")+range+log+
ggplot2::geom_errorbarh(ggplot2::aes(xmin = `LCI(t)`, xmax = `HCI(t)`), height = 0)+
ggplot2::geom_point(ggplot2::aes(fill = df$Response), fill = ifelse(df$Response > 0, "white", "black"), pch=21, size = abs(df$Response)*10+psize)+
ggplot2::theme(axis.line = ggplot2::element_line(colour = "black"),
axis.text.y = ggplot2::element_text(colour = "black"),
axis.title.y = ggplot2::element_text(colour = "black"),
legend.position = "none",
legend.key = ggplot2::element_blank(),
panel.background = ggplot2::element_blank(),
panel.grid.minor = ggplot2::element_blank())}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.