Re: Re: Using Locators in Mathematica v6
- To: mathgroup at smc.vnet.net
- Subject: [mg76571] Re: [mg76472] Re: Using Locators in Mathematica v6
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Thu, 24 May 2007 06:01:40 -0400 (EDT)
- References: <f2u4tq$jv5$1@smc.vnet.net> <22238933.1179927432175.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
Very nice! Bobby On Wed, 23 May 2007 04:07:04 -0500, Jens-Peer Kuska = <kuska at informatik.uni-leipzig.de> wrote: > Hi, > > what is with > data = Table[{x, 1 + 2*x + 0.5*Random[]}, {x, -2, 2, 0.2}]; > > Manipulate[ > DynamicModule[{points, dfit, plt}, > points = Append[data, pnt]; > dfit = Fit[points, {1, x}, x]; > Plot[dfit, {x, -2, 2}, Evaluated -> True , > Epilog -> {Point /@ data}] > ], {{pnt, {0, 0}}, Locator}] > > Regards > Jens > > Coleman, Mark wrote: >> Greetings, >> >> I've been exploring some of the new dynamic interface elements in = >> Mathematica v6 >> and I must say they are very impressive indeed. I've managed to set-u= p >> some useful examples using Manipulate. Unfortunately the documentatio= n >> of >> >> One example I am working on involves the use of Locators. The example= >> itself seem straightforward but I cannot quite get the effect I am >> looking for. I am hoping someone on MathGroup can point me in the ri= ght >> direction. >> >> Briefly, I want to illustrate the effects that outlier points an have= on >> a line of best fit. For my example, I generate a small random set of >> points (x(i), y(i)), where y(i) = a + b x(i) + randomerror(i), for >> values a and b. I then calculate the line of best fit using Fit[ ]. I= >> next ListPlot[ ] the underlying set of points and overlay the resulti= ng >> line from Fit[ ]. So far very simple. >> >> In my dynamic example, I'd like to have a locator button appear on th= e >> graph such that the (x,y) location of the locator becomes an addition= al >> data point in the overall data set, and thereafter a new line of best= >> fit is calcuated and displayed. Thus as the user moves the locator, a= >> new best fit line is displayed. >> >> I'd appreciate any assistance other readers might offer. >> >> Thanks, >> >> -Mark > > -- = DrMajorBob at bigfoot.com