Skip to content

Commit

Permalink
changed name of plotting functions to avoid conflicts with ggVennDiagram
Browse files Browse the repository at this point in the history
  • Loading branch information
gavieira committed Jan 6, 2024
1 parent c62bc0c commit 33b3188
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
14 changes: 7 additions & 7 deletions R/06-plots_and_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
#'
Expand Down Expand Up @@ -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') +
Expand Down Expand Up @@ -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") +
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down
8 changes: 4 additions & 4 deletions man/plot_matching_summary.Rd → man/matching_summary_plot.Rd

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

8 changes: 4 additions & 4 deletions man/plot_upset.Rd → man/upset_plot.Rd

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

8 changes: 4 additions & 4 deletions man/plot_venn.Rd → man/venn_plot.Rd

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

0 comments on commit 33b3188

Please sign in to comment.