diff --git a/NAMESPACE b/NAMESPACE index 6d526da..b0ed35e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,10 +3,10 @@ export("%>%") export(biblioverApp) export(biblioverlap) +export(matching_summary_plot) export(merge_input_files) export(merge_results) -export(plot_matching_summary) -export(plot_upset) -export(plot_venn) +export(upset_plot) +export(venn_plot) importFrom(magrittr,"%>%") importFrom(rlang,.data) diff --git a/R/06-plots_and_app.R b/R/06-plots_and_app.R index 35a7e19..c5ecd63 100644 --- a/R/06-plots_and_app.R +++ b/R/06-plots_and_app.R @@ -71,7 +71,7 @@ add_logo_to_plot <- function(plot, #' Extracting list of uuid columns from biblioverlap results #' #' @description -#' Helper function to [plot_venn()] and [plot_upset()] that extracts overlapping data stored in the UUID column. +#' Helper function to [venn_plot()] and [upset_plot()] that extracts overlapping data stored in the UUID column. #' #' @param db_list - list of matched dataframes (with UUID column added by biblioverlap) #' @@ -103,9 +103,9 @@ get_uuid_list <- function(db_list) { #' biblioverlap_results$summary #' #' #Plotting the matching summary -#' plot_matching_summary(biblioverlap_results$summary) +#' matching_summary_plot(biblioverlap_results$summary) #' -plot_matching_summary <- function(matching_summary_df, add_logo = TRUE, text_size = 15, ...) { +matching_summary_plot <- function(matching_summary_df, add_logo = TRUE, text_size = 15, ...) { summary_plot <- matching_summary_df %>% ggplot2::ggplot(ggplot2::aes(x = .data$category, y = .data$n_docs, fill = .data$doc_subset)) + ggplot2::geom_bar(stat = 'identity', position = 'stack') + @@ -137,9 +137,9 @@ plot_matching_summary <- function(matching_summary_df, add_logo = TRUE, text_siz #' lapply(biblioverlap_results$db_list, head, n=1) #' #' #Plotting the Venn diagram -#' plot_venn(biblioverlap_results$db_list) +#' venn_plot(biblioverlap_results$db_list) #' -plot_venn <- function(db_list, add_logo = TRUE, ...) { +venn_plot <- function(db_list, add_logo = TRUE, ...) { uuid <- get_uuid_list(db_list) venn <- ggVennDiagram::ggVennDiagram(uuid, ...) + ggplot2::scale_fill_gradient(low = "#A7C7E7", high = "#08306B") + @@ -169,9 +169,9 @@ plot_venn <- function(db_list, add_logo = TRUE, ...) { #' lapply(biblioverlap_results$db_list, head, n=1) #' #' #Plotting the UpSet plot -#' plot_upset(biblioverlap_results$db_list) +#' upset_plot(biblioverlap_results$db_list) #' -plot_upset <- function(db_list, add_logo = TRUE, ...) { +upset_plot <- function(db_list, add_logo = TRUE, ...) { uuid <- get_uuid_list(db_list) upset <- UpSetR::upset(UpSetR::fromList(uuid), main.bar.color = "#08306B", diff --git a/README.Rmd b/README.Rmd index cacc753..beb032d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -72,25 +72,25 @@ biblioverlap_results <- biblioverlap(ufrj_bio_0122, matching_fields = matching_c sapply(biblioverlap_results, class) ``` -The package also features some functions for plotting the results of `biblioverlap()`. For instance, the `plot_matching_summary()` function can be used to convert the summary of the matching procedure into a bar plot. +The package also features some functions for plotting the results of `biblioverlap()`. For instance, the `matching_summary_plot()` function can be used to convert the summary of the matching procedure into a bar plot. ```{r matching_summary} #Plotting the matching results summary -plot_matching_summary(biblioverlap_results$summary) +matching_summary_plot(biblioverlap_results$summary) ``` -The `plot_venn()` function uses the UUID column to plot the results of the matching procedure as a Venn diagram. +The `venn_plot()` function uses the UUID column to plot the results of the matching procedure as a Venn diagram. ```{r venn} #Plotting the Venn diagram -plot_venn(biblioverlap_results$db_list) +venn_plot(biblioverlap_results$db_list) ``` -Similarly, the `plot_upset()` function uses the UUID column to generate a UpSet plot, which is generally better for visualizing intersections between 5 or more datasets. +Similarly, the `upset_plot()` function uses the UUID column to generate a UpSet plot, which is generally better for visualizing intersections between 5 or more datasets. ```{r upset} #Plotting the UpSet plot -plot_upset(biblioverlap_results$db_list) +upset_plot(biblioverlap_results$db_list) ``` diff --git a/man/plot_matching_summary.Rd b/man/matching_summary_plot.Rd similarity index 88% rename from man/plot_matching_summary.Rd rename to man/matching_summary_plot.Rd index e27bb40..3a60975 100644 --- a/man/plot_matching_summary.Rd +++ b/man/matching_summary_plot.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/06-plots_and_app.R -\name{plot_matching_summary} -\alias{plot_matching_summary} +\name{matching_summary_plot} +\alias{matching_summary_plot} \title{Plotting biblioverlap's matching summary} \usage{ -plot_matching_summary( +matching_summary_plot( matching_summary_df, add_logo = TRUE, text_size = 15, @@ -42,6 +42,6 @@ biblioverlap_results <- biblioverlap(ufrj_bio_0122[1:2]) biblioverlap_results$summary #Plotting the matching summary -plot_matching_summary(biblioverlap_results$summary) +matching_summary_plot(biblioverlap_results$summary) } diff --git a/man/plot_upset.Rd b/man/upset_plot.Rd similarity index 88% rename from man/plot_upset.Rd rename to man/upset_plot.Rd index 64f8d93..22b6b1f 100644 --- a/man/plot_upset.Rd +++ b/man/upset_plot.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/06-plots_and_app.R -\name{plot_upset} -\alias{plot_upset} +\name{upset_plot} +\alias{upset_plot} \title{Plotting UpSet plot from biblioverlap results} \usage{ -plot_upset(db_list, add_logo = TRUE, ...) +upset_plot(db_list, add_logo = TRUE, ...) } \arguments{ \item{db_list}{\itemize{ @@ -33,6 +33,6 @@ biblioverlap_results <- biblioverlap(ufrj_bio_0122[1:2]) lapply(biblioverlap_results$db_list, head, n=1) #Plotting the UpSet plot -plot_upset(biblioverlap_results$db_list) +upset_plot(biblioverlap_results$db_list) } diff --git a/man/plot_venn.Rd b/man/venn_plot.Rd similarity index 89% rename from man/plot_venn.Rd rename to man/venn_plot.Rd index b4af17d..4d7804c 100644 --- a/man/plot_venn.Rd +++ b/man/venn_plot.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/06-plots_and_app.R -\name{plot_venn} -\alias{plot_venn} +\name{venn_plot} +\alias{venn_plot} \title{Plotting Venn Diagram from biblioverlap results} \usage{ -plot_venn(db_list, add_logo = TRUE, ...) +venn_plot(db_list, add_logo = TRUE, ...) } \arguments{ \item{db_list}{\itemize{ @@ -33,6 +33,6 @@ biblioverlap_results <- biblioverlap(ufrj_bio_0122[1:2]) lapply(biblioverlap_results$db_list, head, n=1) #Plotting the Venn diagram -plot_venn(biblioverlap_results$db_list) +venn_plot(biblioverlap_results$db_list) }