diff options
author | ranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc> | 2006-04-03 16:28:19 +0000 |
---|---|---|
committer | ranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc> | 2006-04-03 16:28:19 +0000 |
commit | c5315525c80a6822eef2311e6b0733ee5018db60 (patch) | |
tree | b43c367c68620cd9429019d6d9ed89cd70984344 /R/drplot.R | |
parent | 27a255ea7e95c1924f34a5d3aa0bcd39ad902b98 (diff) |
- The drplot function now accepts custom xlim and ylim values
- Confidence intervals for the EC50 can now (again) be generated by
drfit by giving the argument conf=TRUE
- Update of the INDEX
git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/drfit@62 d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc
Diffstat (limited to 'R/drplot.R')
-rw-r--r-- | R/drplot.R | 30 |
1 files changed, 19 insertions, 11 deletions
@@ -1,6 +1,7 @@ drplot <- function(drresults, data, dtype = "std", alpha = 0.95, ctype = "none", path = "./", fileprefix = "drplot", overlay = FALSE, + xlim = c("auto","auto"), ylim = c("auto","auto"), postscript = FALSE, pdf = FALSE, png = FALSE, bw = TRUE, pointsize = 12, @@ -14,14 +15,15 @@ drplot <- function(drresults, data, unit <- "different units" } - # Get the plot limits on the x-axis (log of the dose) and y axis + # Determine the plot limits on the x-axis and y axis if(is.data.frame(data)) { + # Get rid of pseudo substance names of controls nonzerodata <- subset(data,dose!=0) - nonzerodata$substance <- factor(nonzerodata$substance) # Get rid of pseudo substance names of controls + nonzerodata$substance <- factor(nonzerodata$substance) zerodata <- subset(data,dose==0) nc <- length(zerodata$dose) # Number of control points if (nc > 0) { - sdc <- sd(zerodata$response) # Standard deviation of control responses + sdc <- sd(zerodata$response) controlconf <- sdc * qt((1 + alpha)/2, nc - 1) / sqrt(nc) cat("There are ",nc,"data points with dose 0 (control values)\n") cat("with a standard deviation of",sdc,"\n") @@ -52,6 +54,12 @@ drplot <- function(drresults, data, hr <- 1.0 } } + if (xlim[1] == "auto") xlim[1] <- lld - 0.5 + if (xlim[2] == "auto") xlim[2] <- lhd + 1 + if (ylim[1] == "auto") ylim[1] <- -0.1 + if (ylim[2] == "auto") ylim[2] <- hr + 0.2 + xlim <- as.numeric(xlim) + ylim <- as.numeric(ylim) # Prepare overlay plot if requested if (overlay) @@ -79,10 +87,10 @@ drplot <- function(drresults, data, } plot(0,type="n", - xlim=c(lld - 0.5, lhd + 1), - ylim= c(-0.1, hr + 0.2), - xlab=paste("Decadic Logarithm of the dose in ", unit), - ylab="Normalized response") + xlim = xlim, + ylim = ylim, + xlab = paste("Decadic Logarithm of the dose in ", unit), + ylab = "Normalized response") } # Plot the data either as raw data or as error bars @@ -123,10 +131,10 @@ drplot <- function(drresults, data, } plot(0,type="n", - xlim=c(lld - 0.5, lhd + 2), - ylim= c(-0.1, hr + 0.2), - xlab=paste("Decadic Logarithm of the dose in ", unit), - ylab="Normalized response") + xlim = xlim, + ylim = ylim, + xlab = paste("Decadic Logarithm of the dose in ", unit), + ylab = "Normalized response") } if (!overlay) legend(lpos, i,lty = 1, col = color, inset=0.05) tmp$dosefactor <- factor(tmp$dose) # necessary because the old |