diff options
author | ranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc> | 2005-07-15 11:28:06 +0000 |
---|---|---|
committer | ranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc> | 2005-07-15 11:28:06 +0000 |
commit | f78a6461cb0510d606fa420bd8fc1683a8815d4b (patch) | |
tree | 07d1eba7d0ccd83f2b8952d564fe475f3a194550 /R | |
parent | 86e56128b7ca0eae433f5796364fc81d98e87fd3 (diff) |
Some cleanup of the legend positioning, which can be used starting from
R version 2.1.0.
git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/drfit@28 d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc
Diffstat (limited to 'R')
-rw-r--r-- | R/drfit.R | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -235,7 +235,7 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE, drplot <- function(drresults, data, dtype = "std", alpha = 0.95, path = "./", fileprefix = "drplot", overlay = FALSE, postscript = FALSE, png = FALSE, bw = TRUE, - colors = 1:8,devoff=T,lpos=FALSE) + colors = 1:8,devoff=T,lpos="topright") { unitlevels <- levels(as.factor(drresults$unit)) if (length(unitlevels) == 1) { @@ -264,15 +264,6 @@ drplot <- function(drresults, data, dtype = "std", alpha = 0.95, } } - # Legend position - if (!lpos[[1]]) { - lx <- lhd - 1 - ly <- hr + 0.1 - } else { - lx <- lpos[[1]] - ly <- lpos[[2]] - } - # Prepare overlay plot if requested if (overlay) { @@ -335,7 +326,7 @@ drplot <- function(drresults, data, dtype = "std", alpha = 0.95, xlab=paste("Decadic Logarithm of the dose in ", unit), ylab="Normalized response") } - if (!overlay) legend("topright", i,lty = 1, col = color, inset=0.05) + if (!overlay) legend(lpos, i,lty = 1, col = color, inset=0.05) tmp$dosefactor <- factor(tmp$dose) # necessary because the old # factor has all levels, not # only the ones tested with @@ -402,7 +393,7 @@ drplot <- function(drresults, data, dtype = "std", alpha = 0.95, } } } - if (overlay) legend("topright", dsubstances,lty = 1, col = colors, inset=0.05) + if (overlay) legend(lpos, dsubstances,lty = 1, col = colors, inset=0.05) if (overlay && (postscript || png)) { if (devoff) { dev.off() @@ -484,7 +475,7 @@ checkplate <- function(plate,db="cytotox") points(log10(drdatalist[[i]]$conc),drdatalist[[i]][[responsetype]],col=i); } - legend(3.0,1.5,substances, pch=1, col=1:length(substances)) + legend("topright",substances, pch=1, col=1:length(substances), inset=0.05) title(main=paste("Plate ",plate," - ",levels(platedata$experimentator)," - ",levels(platedata$type))) } } @@ -540,7 +531,7 @@ checksubstance <- function(substance,db="cytotox",experimentator="%",celltype="% points(log10(platelist[[i]]$conc),platelist[[i]][[responsetype]],col=i); } - legend(3.5,1.7,plates, pch=1, col=1:length(plates)) + legend("topright", plates, pch=1, col=1:length(plates), inset=0.05) title(main=paste(substance," - ",levels(data$experimentator)," - ",levels(data$type))) cat("Substanz ",substance,"\n", |