diff options
author | ranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc> | 2004-11-19 08:58:27 +0000 |
---|---|---|
committer | ranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc> | 2004-11-19 08:58:27 +0000 |
commit | 6f44c70650c7bae8b7960b8ff9b4680ef37d9749 (patch) | |
tree | b9e9f738f001ddba884caad0713bd11718b12f7e | |
parent | cb16cc35737192eb78d8172b9af8455d1c68ae9c (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
-rw-r--r-- | DESCRIPTION | 2 | ||||
-rw-r--r-- | R/drfit.R | 24 | ||||
-rw-r--r-- | chm/00Index.html | 2 | ||||
-rw-r--r-- | chm/drfit.chm | bin | 30187 -> 30423 bytes | |||
-rw-r--r-- | chm/drplot.html | 10 | ||||
-rw-r--r-- | 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 <jranke@uni-bremen.de> @@ -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 @@ <param name="keyword" value=".. contents">
</object>
+<h2>Help pages for package `drfit' version 0.03-9</h2>
+
<table width="100%">
<tr><td width="25%"><a href="antifoul.html">antifoul</a></td>
diff --git a/chm/drfit.chm b/chm/drfit.chm Binary files differindex ddded13..d88cbb3 100644 --- a/chm/drfit.chm +++ b/chm/drfit.chm 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. <pre>
drplot(drresults, data, dtype, alpha, path, fileprefix, overlay,
- postscript, color, colors, fitcolors)
+ postscript, color, datacolors, fitcolors)
</pre>
@@ -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
</td></tr>
-<tr valign="top"><td><code>colors</code></td>
+<tr valign="top"><td><code>datacolors</code></td>
<td>
This is a vector of colors, defaulting to 1:8, used for plotting the data.
</td></tr>
<tr valign="top"><td><code>fitcolors</code></td>
<td>
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.
</td></tr>
</table>
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{ |