From 6f44c70650c7bae8b7960b8ff9b4680ef37d9749 Mon Sep 17 00:00:00 2001 From: ranke Date: Fri, 19 Nov 2004 08:58:27 +0000 Subject: 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 --- DESCRIPTION | 2 +- R/drfit.R | 24 +++++++++++++++--------- chm/00Index.html | 2 ++ chm/drfit.chm | Bin 30187 -> 30423 bytes chm/drplot.html | 10 +++++++--- man/drplot.Rd | 10 +++++++--- 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index aa88622..7c7c736 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: drfit -Version: 0.03-8 +Version: 0.03-9 Date: 2004-09-16 Title: Dose-response data evaluation Author: Johannes Ranke 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) diff --git a/chm/00Index.html b/chm/00Index.html index db1b1cd..066b05a 100644 --- a/chm/00Index.html +++ b/chm/00Index.html @@ -10,6 +10,8 @@ +

Help pages for package `drfit' version 0.03-9

+ diff --git a/chm/drfit.chm b/chm/drfit.chm index ddded13..d88cbb3 100644 Binary files a/chm/drfit.chm and b/chm/drfit.chm differ diff --git a/chm/drplot.html b/chm/drplot.html index c141a7a..84cf12e 100644 --- a/chm/drplot.html +++ b/chm/drplot.html @@ -24,7 +24,7 @@ either combined or separately, for one or more substances.
   drplot(drresults, data, dtype, alpha, path, fileprefix, overlay,
-    postscript, color, colors, fitcolors)
+    postscript, color, datacolors, fitcolors)
 
@@ -85,14 +85,18 @@ displayed with a screen graphics device. If TRUE, a sensible selection of colors will be attempted. If false, everything will be drawn in black - +
antifoul
colors
datacolors This is a vector of colors, defaulting to 1:8, used for plotting the data.
fitcolors Here you can specify a palette for the colors of the dose-response fits. The -default value is "default", which produces rainbow colors. +default value is "default", which produces the default palette, if the +number of fits to be plotted is 8 or less. Otherwise, rainbow colors +will be plotted. Unless there is more than one fit per substance to be plotted, +or the number of fits is larger than 8, the fitcolors will match the +datacolors.
diff --git a/man/drplot.Rd b/man/drplot.Rd index f201332..3708d4b 100644 --- a/man/drplot.Rd +++ b/man/drplot.Rd @@ -7,7 +7,7 @@ } \usage{ drplot(drresults, data, dtype, alpha, path, fileprefix, overlay, - postscript, color, colors, fitcolors) + postscript, color, datacolors, fitcolors) } \arguments{ \item{drresults}{ @@ -55,12 +55,16 @@ If TRUE, a sensible selection of colors will be attempted. If false, everything will be drawn in black } - \item{colors}{ + \item{datacolors}{ This is a vector of colors, defaulting to 1:8, used for plotting the data. } \item{fitcolors}{ Here you can specify a palette for the colors of the dose-response fits. The - default value is "default", which produces rainbow colors. + default value is "default", which produces the default palette, if the + number of fits to be plotted is 8 or less. Otherwise, rainbow colors + will be plotted. Unless there is more than one fit per substance to be plotted, + or the number of fits is larger than 8, the fitcolors will match the + datacolors. } } \value{ -- cgit v1.2.1