[R] log axis assignment
Marc Schwartz
mschwartz at medanalytics.com
Tue Mar 4 06:27:03 CET 2003
>-----Original Message-----
>From: r-help-admin at stat.math.ethz.ch
>[mailto:r-help-admin at stat.math.ethz.ch] On Behalf Of Jeremy Z Butler
>Sent: Monday, March 03, 2003 10:57 PM
>To: r-help at stat.math.ethz.ch
>Subject: [R] log axis assignment
>
>
>Hi again,
>another problem:
>
>This (below) isn't working and as far as I can see it damn
>well should. What
>I'm trying to acomplish is to run several data sets through the same
>graphing procedure, but for the pH data use a log y axis.
>using this code
>all graphs are drawn with a linear axis. Surely I should be
>able to set the
>ylog option to T using another object (logaxis).
>
>for (n in colnames(raw))
>{
>if(n=="pH"){logaxis<-"T"} else {logaxis<-"F"}
>plot(full.age,raw[,n],type="n",ylog=logaxis)
>...
>}
>
>Any ideas what I'm doing wrong? I assume its something to do
>with the ylog
>(and xlog) options being read-only but I'm not sure what that means.
J
You cannot set the log scaling in the fashion in which you are trying
by setting par(ylog) as an argument to plot(). Presumably you are
getting the following error message:
"parameter "ylog" couldn't be set in high-level plot() function"
Try this instead using the proper 'log' argument to plot:
for (n in colnames(raw))
{
if(n == "pH")
plot(full.age, raw[,n], type = "n", log = "y")
else
plot(full.age, raw[,n], type = "n")
...
}
See ?plot.default for more information.
Also, "T" and "F" as quoted characters are not the same as TRUE and
FALSE as logical boolean values.
HTH,
Marc Schwartz
More information about the R-help
mailing list