[R] ?plot: Add an example on how to plot functions to the help of `plot`.
Paul Menzel
paulepanter at users.sourceforge.net
Thu Jul 28 00:31:18 CEST 2011
Am Mittwoch, den 27.07.2011, 18:04 -0400 schrieb David Winsemius:
> On Jul 27, 2011, at 5:53 PM, Paul Menzel wrote:
> > as `plot.function` is not explicitly mentioned in `?plot`.
>
> Right, but the fact that it _is_ described as a "generic" function
> will tell the clueful that other methods other than the default method
> may exist, and that their availability may vary with which packages
> are loaded.
Of course, when you know what to do it is clear where to look. I just
want to offer a view point from a beginner and adding that little
comment would have saved me half an hour. (Because searching for »r
plotting function« did not result in good hits.)
> > One further comment regarding the examples in `?plot.function`. Trying
> > those in order
> >
> > op <- par(mfrow = c(2, 2))
> > chippy <- function(x) sin(cos(x)*exp(-x/2))
> > plot (chippy, -8, -5)
> > for(ll in c("", "x", "y", "xy"))
> > curve(log(1+x), 1, 100, log = ll,
> > sub = paste("log= '", ll, "'", sep = ""))
> > par(op)
> >
> > I do not see any effect executing `par(op)` at the end. Reading `?
> > par` I
> > assume it should go before the for loop?
>
> No. Read:
>
> ?par
>
> It has both a value and a side-effect. Pay particular attention to its
> value for its first invocation. Then think about why its side-effect
> is what you want _after_ the loop. Then you may understand what is
> happening. Report back to the class. (This isn't in the Introductory
> material you are reading?)
I messed up and somehow missed to execute `op <- par(mfrow = c(2, 2))`
when first running the examples and jumped to wrong conclusion. I am
sorry for the noise.
Thank you for your patience and help,
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110728/89ecc1ab/attachment.bin>
More information about the R-help
mailing list