Skip to content

Commit

Permalink
pir_plot reverted to the traditional form
Browse files Browse the repository at this point in the history
  • Loading branch information
Giappo committed Jun 19, 2019
1 parent 24bdf67 commit cf63314
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 deletions.
39 changes: 15 additions & 24 deletions R/pir_plot.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#' Plot the error BEAST2 make from the known phylogeny
#' @param pir_out the output created by \code{\link{pir_run}}
#' @param show_title TRUE if you want to show the title. FALSE otherwise.
#' @return a ggplot2 plot
#' @seealso
#' Use \link{create_test_pir_run_output} to create a test output
Expand All @@ -15,10 +14,7 @@
#' )
#' pir_plot(pir_out)
#' @export
pir_plot <- function(
pir_out,
show_title = TRUE
) {
pir_plot <- function(pir_out) {

# Satisfy R CMD check
tree <- NULL; rm(tree) # nolint, fixes warning: no visible binding for global variable
Expand Down Expand Up @@ -193,21 +189,6 @@ pir_plot <- function(
index <- trunc(0.95 * length(df_long$error_value))
x_top <- sort(df_long$error_value)[index]

##############################################################################
# Plot settings
##############################################################################
if (show_title == TRUE) {
plot_title <- "Inference error distribution"
} else {
plot_title <- NULL
}
labs <- ggplot2::labs(
x = "Error",
y = "Density",
fill = "Model and tree",
color = "Model and tree"
)

##############################################################################
# Plot it (Single Plot)
##############################################################################
Expand Down Expand Up @@ -243,8 +224,13 @@ pir_plot <- function(
),
linetype = "dashed"
) +
ggplot2::ggtitle(plot_title) +
labs + theme
ggplot2::ggtitle("Inference error distribution") +
ggplot2::labs(
x = "Error",
y = "Density",
fill = "Model and tree",
color = "Model and tree"
) + theme
}
##############################################################################
# Split Candidate plot from Generative Plot
Expand Down Expand Up @@ -316,8 +302,13 @@ pir_plot <- function(
),
linetype = "dashed"
) +
ggplot2::ggtitle(plot_title) +
labs + theme
ggplot2::ggtitle("Inference error distribution") +
ggplot2::labs(
x = "Error",
y = "Density",
fill = "Model and tree",
color = "Model and tree"
) + theme
}
plot
}
4 changes: 1 addition & 3 deletions man/pir_plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf63314

Please sign in to comment.