aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc>2004-11-19 08:58:27 +0000
committerranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc>2004-11-19 08:58:27 +0000
commit6f44c70650c7bae8b7960b8ff9b4680ef37d9749 (patch)
treeb9e9f738f001ddba884caad0713bd11718b12f7e /R
parentcb16cc35737192eb78d8172b9af8455d1c68ae9c (diff)
I improved the color defaults in drplot, so under simple circumstances
the same colors are chosen for data and fited curves. git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/drfit@9 d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc
Diffstat (limited to 'R')
-rw-r--r--R/drfit.R24
1 files changed, 15 insertions, 9 deletions
diff --git a/R/drfit.R b/R/drfit.R
index bd93f8a..62434bc 100644
--- a/R/drfit.R
+++ b/R/drfit.R
@@ -183,7 +183,7 @@ drplot <- function(drresults, data = FALSE, dtype = "std", alpha = 0.95,
path = "./", fileprefix = "drplot", overlay = FALSE,
postscript = FALSE,
color = TRUE,
- colors = 1:8, fitcolors = "default")
+ datacolors = 1:8, fitcolors = "default")
{
# Prepare plots
devices <- 1
@@ -257,16 +257,16 @@ drplot <- function(drresults, data = FALSE, dtype = "std", alpha = 0.95,
xlab=paste("Decadic Logarithm of the dose in ", unit),
ylab="Normalized response")
}
- if (color == FALSE) colors <- rep("black",length(dsubstances))
+ if (color == FALSE) datacolors <- rep("black",length(dsubstances))
n <- n + 1
- if (!overlay) legend(lhd - 1, hr + 0.1, i,lty = 1, col = colors[[n]])
+ if (!overlay) legend(lhd - 1, hr + 0.1, i,lty = 1, col = datacolors[[n]])
tmp <- splitted[[i]]
tmp$dosefactor <- factor(tmp$dose) # necessary because the old
# factor has all levels, not
# only the ones tested with
# this substance
if (dtype == "raw") {
- points(log10(tmp$dose),tmp$response,col=colors[[n]])
+ points(log10(tmp$dose),tmp$response,col=datacolors[[n]])
} else {
splitresponses <- split(tmp$response,tmp$dosefactor)
means <- sapply(splitresponses,mean)
@@ -288,11 +288,11 @@ drplot <- function(drresults, data = FALSE, dtype = "std", alpha = 0.95,
if (dtype != "raw")
{
x <- log10(as.numeric(levels(tmp$dosefactor)))
- segments(x,bottoms,x,tops,col=colors[[n]])
- points(x,means,col=colors[[n]])
+ segments(x,bottoms,x,tops,col=datacolors[[n]])
+ points(x,means,col=datacolors[[n]])
smidge <- 0.05
- segments(x - smidge,bottoms,x + smidge,bottoms,col=colors[[n]])
- segments(x - smidge,tops,x + smidge,tops,col=colors[[n]])
+ segments(x - smidge,bottoms,x + smidge,bottoms,col=datacolors[[n]])
+ segments(x - smidge,tops,x + smidge,tops,col=datacolors[[n]])
}
}
}
@@ -302,7 +302,13 @@ drplot <- function(drresults, data = FALSE, dtype = "std", alpha = 0.95,
nf <- length(fits$Substance) # number of fits to plot
if (fitcolors[[1]] == "default")
{
- defaultfitcolors <- rainbow(nf)
+ if (nf <= 8)
+ {
+ defaultfitcolors <- palette()
+ } else
+ {
+ defaultfitcolors <- rainbow(nf)
+ }
}
legendcolors <- vector()
for (i in 1:nf)

Contact - Imprint