Skip to content

Commit

Permalink
Merge pull request #47 from dnldelarosa/master
Browse files Browse the repository at this point in the history
Add `padding` argument to `ggvenn` to address label truncation
  • Loading branch information
dnldelarosa authored Aug 18, 2024
2 parents 243eca0 + 26b3ca9 commit 6e6380d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ggvenn
Title: Draw Venn Diagram by 'ggplot2'
Version: 0.1.14
Version: 0.1.15
Authors@R: person(given = "Linlin", family = "Yan",
role = c("aut", "cre"),
email = "yanlinlin82@gmail.com",
Expand All @@ -14,10 +14,12 @@ License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.1
Depends: ggplot2
Imports: dplyr, grid, scales
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
Roxygen: list(markdown = TRUE)
Imports:
dplyr,
grid,
scales,
lifecycle
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
6 changes: 5 additions & 1 deletion R/ggvenn.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#' @param show_outside Show outside elements (not belongs to any set).
#' @param auto_scale Allow automatically resizing circles according to element counts.
#' @param comma_sep Whether to use comma as separator for displaying numbers.
#' @param padding Padding for the plot. Change this to allow longer labels to be displayed.
#' @return The ggplot object to print or save to file.
#' @examples
#' library(ggvenn)
Expand Down Expand Up @@ -82,7 +83,8 @@ ggvenn <- function(data, columns = NULL,
count_column = NULL,
show_outside = c("auto", "none", "always"),
auto_scale = FALSE,
comma_sep=FALSE) {
comma_sep=FALSE,
padding = 0.2) {
show_outside <- match.arg(show_outside)
if (lifecycle::is_present(show_percentage)) {
lifecycle::deprecate_soft("0.1.11", "ggvenn::ggvenn(show_percentage = )", "ggvenn::ggvenn(show_stats = )")
Expand Down Expand Up @@ -126,6 +128,8 @@ ggvenn <- function(data, columns = NULL,
}
g <- g +
scale_fill_manual(values = fill_color) +
scale_x_discrete(expand = expansion(mult = c(padding, padding))) +
scale_y_discrete(expand = expansion(mult = c(padding, padding))) +
guides(fill = "none") +
coord_fixed() +
theme_void()
Expand Down

0 comments on commit 6e6380d

Please sign in to comment.