From aedbf77fbc4a07b6f58a58cfd310e83028fe4830 Mon Sep 17 00:00:00 2001 From: xushuangbin Date: Wed, 5 Jun 2024 16:06:22 +0800 Subject: [PATCH] only consider the ratio of each slice of pie --- R/geom_scatterpie.R | 4 ++-- R/utilities.R | 2 +- man/geom_scatterpie.Rd | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/geom_scatterpie.R b/R/geom_scatterpie.R index 00ce2a0..3e038e5 100644 --- a/R/geom_scatterpie.R +++ b/R/geom_scatterpie.R @@ -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 diff --git a/R/utilities.R b/R/utilities.R index cec4495..6d81b69 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -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']] diff --git a/man/geom_scatterpie.Rd b/man/geom_scatterpie.Rd index 9d3a53e..e263842 100644 --- a/man/geom_scatterpie.Rd +++ b/man/geom_scatterpie.Rd @@ -41,8 +41,8 @@ default is NULL, when it is provided, the ratio or value label will be displayed \item{label_show_ratio}{logical only work when \code{label_radius} is not NULL, default is TRUE, meaning the ratio of label will be displayed.} -\item{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.} +\item{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.} \item{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.}