Skip to content

Commit

Permalink
added color_fill to logistic and continuous when with lineranges and …
Browse files Browse the repository at this point in the history
…continuous do not force breaks between 0/1
  • Loading branch information
certara-smouksassi committed Jan 11, 2024
1 parent 32b7412 commit 79486ef
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 8 deletions.
21 changes: 16 additions & 5 deletions R/ggcontinuousexpdist.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ plogis <- function(x) exp(x)/(1+exp(x))
#' a / b +
#'plot_layout(guides = "collect") &
#' theme(legend.position = "top")
#' #Example 2
#' effICGI$SEX <- as.factor(effICGI$SEX)
#' ggcontinuousexpdist(data = effICGI |>
#' dplyr::filter(Endpoint =="ICGI7"),
#' response = "response",
#' endpoint = "Endpoint",
#' color_fill = "SEX",
#' exposure_metrics = c("AUC"),
#' exposure_metric_split = c("quartile"),
#' exposure_metric_soc_value = -99,
#' exposure_metric_plac_value = 0,
#' dist_position_scaler = 1, dist_offset = -1 ,
#' yproj_xpos = -20 ,
#' yproj_dodge = 20 ,
#' exposure_distribution ="lineranges")
#'\dontrun{
#' #Example 5
#'}
Expand Down Expand Up @@ -138,7 +153,7 @@ ggcontinuousexpdist <- function(data = effICGI,
yaxis_position <- match.arg(yaxis_position, several.ok = FALSE)

effICGI = expname = expvalue = DOSE2 = quant = values = Ncat = Ntot = xmed = percentage = exptile = keynumeric = NULL
intercept = medexp = prob = SE = N = ndensity = Endpoint = NULL
intercept = medexp = prob = SE = N = ndensity = Endpoint = color_fill2 = NULL

data <- data |>
dplyr::mutate(none = "(all)") # needed when no metric are chosen
Expand Down Expand Up @@ -524,10 +539,6 @@ ggcontinuousexpdist <- function(data = effICGI,
if(exposure_distribution =="lineranges"){
p2df2 <- p2df +
ggplot2::scale_y_continuous(position = yaxis_position,
breaks =c(
c(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1) ),
labels= c(
c("0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1") ),
expand = ggplot2::expansion(mult=c(0.01,0.01), add =c(0, 0)))
}
p2df2 +
Expand Down
20 changes: 18 additions & 2 deletions R/gglogisticexpdist.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,24 @@ plogis <- function(x) exp(x)/(1+exp(x))
#' ggplot2::coord_cartesian(xlim = c(-30,355))+
#' ggplot2::facet_grid(~Endpoint)
#'\dontrun{
#' #Example 4b
#' effICGI$SEX <- as.factor(effICGI$SEX)
#' gglogisticexpdist(data = effICGI |>
#' dplyr::filter(Endpoint =="ICGI"),
#' response = "response",
#' endpoint = "Endpoint",
#' color_fill = "SEX",
#' exposure_metrics = c("AUC"),
#' exposure_metric_split = c("quartile"),
#' exposure_metric_soc_value = -99,
#' exposure_metric_plac_value = 0,
#' dist_position_scaler = 1, dist_offset = -1 ,
#' yproj_xpos = -20 ,
#' yproj_dodge = 20 ,
#' exposure_distribution ="lineranges")
#'
#' #Example 5
#' gglogisticexpdist(data = effICGI |> filter(Endpoint=="ICGI"),
#' gglogisticexpdist(data = effICGI |> dplyr::filter(Endpoint=="ICGI"),
#' response = "response",
#' endpoint = "Endpoint",
#' DOSE = "DOSE",
Expand Down Expand Up @@ -213,7 +229,7 @@ gglogisticexpdist <- function(data = effICGI,
yaxis_position <- match.arg(yaxis_position, several.ok = FALSE)

effICGI = expname = expvalue = DOSE2 = quant = values = Ncat = Ntot = xmed = percentage = exptile = keynumeric = NULL
intercept = medexp = prob = SE = N = ndensity = Endpoint = NULL
intercept = medexp = prob = SE = N = ndensity = Endpoint = color_fill2 = NULL

data <- data |>
dplyr::mutate(none = "(all)") # needed when no metric are chosen
Expand Down
18 changes: 18 additions & 0 deletions man/ggcontinuousexpdist.Rd

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

21 changes: 20 additions & 1 deletion man/gglogisticexpdist.Rd

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

0 comments on commit 79486ef

Please sign in to comment.