Skip to content

Commit

Permalink
added aspect ratio argument
Browse files Browse the repository at this point in the history
  • Loading branch information
mgimond committed Jul 23, 2024
1 parent 4637335 commit e5b408b
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 3 deletions.
10 changes: 8 additions & 2 deletions R/eda_lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
#' function. A robust loess is used by default.
#' @param rlm.d A list of arguments passed to the \code{MASS::rlm}
#' function.
#' @param asp Boolean determining if the plot aspect ratio should equal the
#' ratio of the x and y standard deviations. A value of \code{FALSE} defaults
#' to the base plot's default aspect ratio. A value of \code{TRUE} uses the
#' aspect ratio \code{sd(x)/sd(y)}.
#' @param xlab X label for output plot.
#' @param ylab Y label for output plot.
#' @param ... Not used.
Expand Down Expand Up @@ -128,7 +132,7 @@

eda_lm <- function(dat, x, y, xlab = NULL, ylab = NULL, px = 1, py = 1,
tukey = FALSE, show.par = TRUE, reg = TRUE, poly = 1,
robust = FALSE, w=NULL, sd = TRUE, mean.l = TRUE,
robust = FALSE, w=NULL, sd = TRUE, mean.l = TRUE,asp = TRUE,
grey = 0.6, pch = 21, p.col = "grey50", p.fill = "grey80",
size = 0.8, alpha = 0.8, q = FALSE, q.val = c(0.16,0.84),
q.type = 5, loe = FALSE, lm.col = rgb(1, 0.5, 0.5, 0.8),
Expand Down Expand Up @@ -211,7 +215,9 @@ eda_lm <- function(dat, x, y, xlab = NULL, ylab = NULL, px = 1, py = 1,
mean.x <- mean(x, na.rm=T)
mean.y <- mean(y, na.rm=T)

plot( x=x, y=y , asp=sd.x/sd.y, ylab=NA, las=1, yaxt='n', xaxt='n', xlab=NA,
asp_val <- ifelse(asp == TRUE, sd.x/sd.y, NA) # See if x and y SDs need to match

plot( x=x, y=y , asp=asp_val, ylab=NA, las=1, yaxt='n', xaxt='n', xlab=NA,
col.lab=plotcol, pch = pch, col = p.col, bg = p.fill, cex = size)
box(col=plotcol)
axis(1,col=plotcol, col.axis=plotcol, labels=TRUE, padj = -0.5)
Expand Down
Binary file modified docs/reference/Rplot001.png
Loading
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_lm-1.png
Loading
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_lm-2.png
Loading
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_lm-3.png
Loading
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_lm-4.png
Loading
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_lm-5.png
Loading
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_lm-6.png
Loading
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_lm-7.png
Loading
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_lm-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion docs/reference/eda_lm.html

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

6 changes: 6 additions & 0 deletions man/eda_lm.Rd

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

0 comments on commit e5b408b

Please sign in to comment.