Skip to content

Commit

Permalink
fixed issue with show.par argument
Browse files Browse the repository at this point in the history
  • Loading branch information
mgimond committed Jan 28, 2024
1 parent ae33e0a commit 358888e
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ Suggests:
rmarkdown,
testthat (>= 3.0.0)
VignetteBuilder: knitr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1.9000
Config/testthat/edition: 3
9 changes: 7 additions & 2 deletions R/eda_dens.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#' transformation is applied to the x variable.
#' @param fy Formula to apply to y variable. This is computed after any
#' transformation is applied to the y variable.
#' @param show.par Boolean determining if parameters such as power
#' transformation or formula should be displayed.
#' @param grey Grey level to apply to plot elements (0 to 1 with 1 = black).
#' @param col Fill color for second density distribution.
#' @param size Point size (0-1).
Expand Down Expand Up @@ -49,7 +51,7 @@


eda_dens <- function(x, y, fac = NULL, p = 1L, tukey = FALSE, fx = NULL,
fy = NULL, grey = 0.6, col = "red", size = 0.8,
fy = NULL, show.par = TRUE, grey = 0.6, col = "red", size = 0.8,
alpha = 0.4, xlab = NULL, ylab = NULL, legend = TRUE, ...) {

# Extract data
Expand Down Expand Up @@ -151,7 +153,10 @@ eda_dens <- function(x, y, fac = NULL, p = 1L, tukey = FALSE, fx = NULL,
tck = -0.02)
mtext("Density", side=3, adj= -0.1 , col=plotcol, padj = -1)
title(xlab = "Value", line = 1.8, col.lab=plotcol)
mtext(side = 3, text=paste0("p=",p,";",fx," ",fy,sep=""), adj=1, cex = 0.65)
if(show.par == TRUE){
mtext(side = 3, text=paste0("p=",p,";",fx," ",fy,sep=""), adj=1, cex = 0.65)
}


if (legend == TRUE){
sq <- par("usr") # get plot corners
Expand Down
4 changes: 2 additions & 2 deletions R/eda_qq.R
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,11 @@ eda_qq <- function(x, y=NULL, fac = NULL, norm = FALSE, p = 1L, tukey = FALSE,
}

# Add power/formula parameters to plot
if(norm != TRUE){
if(norm != TRUE & show.par == TRUE){
params <- gsub(";\\s*;?\\s*$", "", paste0("p=", p,"; ",fx,"; ",fy))
params <- gsub("\\; \\;", ";", params)
mtext(side = 3, text=params, adj=1, cex = 0.65)
} else {
} else if (norm == TRUE & show.par == TRUE){
mtext(side = 3, text=paste0("p=",p), adj=1, cex = 0.65)
}

Expand Down
6 changes: 6 additions & 0 deletions R/tukeyedar-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL
1 change: 0 additions & 1 deletion R/tukeyedar.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
#' @description This packages hosts a small set of Tukey inspired functions for use
#' in exploring datasets in a robust manner.
#'
#' @docType package
#' @name tukeyedar
NULL
Binary file modified docs/reference/Rplot001.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/eda_dens-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/eda_dens-2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions docs/reference/eda_dens.html

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

2 changes: 1 addition & 1 deletion docs/reference/index.html

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

4 changes: 4 additions & 0 deletions man/eda_dens.Rd

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

22 changes: 22 additions & 0 deletions man/tukeyedar-package.Rd

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

1 change: 0 additions & 1 deletion man/tukeyedar.Rd

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

0 comments on commit 358888e

Please sign in to comment.