Skip to content

Commit

Permalink
only consider the ratio of each slice of pie
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangpin committed Jun 5, 2024
1 parent f9078b7 commit aedbf77
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions R/geom_scatterpie.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
##' default is NULL, when it is provided, the ratio or value label will be displayed.
##' @param label_show_ratio logical only work when \code{label_radius} is not NULL,
##' default is TRUE, meaning the ratio of label will be displayed.
##' @param label_threshold numeric the threshold is to control display the label, the value or
##' ratio of label smaller than the threshold will not be displayed. default is 0.
##' @param label_threshold numeric the threshold is to control display the label, the ratio of
##' slice pie smaller than the threshold will not be displayed. default is 0.
##' @param donut_radius numeric the radius of donut chart (relative the radius of circle), default is NULL.
##' it should be between 0 and 1, if it is provided, the donut chart will be displayed instead of pie chart.
##' @param bg_circle_radius numeric the radius of background circle, default is FALSE, we suggest setting it
Expand Down
2 changes: 1 addition & 1 deletion R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ is_fixed_radius <- function(rvar) {
x[[".RATIO"]] <- round(x[[var]]/sum(x[[var]]), 2)
x[[var]] <- round(x[[var]], 2)
x[['.RATIO']] <- ifelse(x[['.RATIO']] < threshold, NA, x[[".RATIO"]])
x[[var]] <- ifelse(x[[var]] < threshold, NA, x[[var]])
x[[var]] <- ifelse(x[['.RATIO']] < threshold, NA, x[[var]])
x[['hjust']] <- ifelse(mid_angle > pi, 1, 0)
x[['vjust']] <- ifelse(mid_angle < pi/2 | mid_angle > 3 * pi/2, 0, 1)
x[['x']] <- rlabel * x[[r]] * sin(mid_angle) + x[['x']]
Expand Down
4 changes: 2 additions & 2 deletions man/geom_scatterpie.Rd

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

0 comments on commit aedbf77

Please sign in to comment.