Thanks to all three of you

2010/4/15 Greg Snow <greg.s...@imail.org>

> Or here is a way to plot against one of the variables while interactively
> changing the other one:
>
> library(TeachingDemos)
>
> myfun <- function(x,y) sin(x^2) * cos(y^2)
>
> myfun2 <- function(y) curve( myfun(x,y), from=-pi, to=pi, ylim=c(-1,1) )
>
> tkexamp( myfun2,
>        list( y=list('slider', from=-pi, to=pi, resolution=2*pi/50, init=0)
> ) )
>
>
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
>
>
> > -----Original Message-----
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> > project.org] On Behalf Of Duncan Murdoch
> > Sent: Thursday, April 15, 2010 7:29 AM
> > To: Dwayne Blind
> > Cc: r-help@r-project.org
> > Subject: Re: [R] curve
> >
>  > On 14/04/2010 4:59 PM, Dwayne Blind wrote:
> > > Dear R users,
> > >
> > > How can I use "curve" with a function of two variables ?
> > >
> >
> > See Ben Bolker's reply if you want to plot a surface.  If you want to
> > plot a curve by holding one of the two variables fixed, just set it to
> > a
> > constant value, and use "x" as the other variable, e.g.
> >
> > f <- function(x, y) { x^2 + y^2 }
> >
> > curve(f(x, 2), from= .... )
> >
> > curve(f(3, x), from= .... )
> >
> > or wrap the function in a one variable function if you want to follow
> > some complicated path, e.g.
> >
> > curve(function(t) f(t, t^2), from=....)
> >
> > Duncan Murdoch
> >
>  > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide 
> > http://www.R-project.org/posting-<http://www.r-project.org/posting->
> > guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to