Re: Need Help With Locator in a Manipulate
- To: mathgroup at smc.vnet.net
- Subject: [mg132274] Re: Need Help With Locator in a Manipulate
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Tue, 28 Jan 2014 06:16:23 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <20140126081421.81CD369D3@smc.vnet.net>
Thanks again Bob,
Much appreciated as always. I figured out how to stop the jiggle. I put the statement for resetting the locator in the Epilog of the plot in the way I described in my previous email
Locator[Dynamic[pt2, pt2 = {pt2[[1]], m pt2[[1]] + pt1[[2]] - m*pt1[[1]]}]]
and in the control section of the Manipulate, I set the Appearance of the locator to None.
{{pt2, {25, 80}}, Locator, Appearance -> None},
That way the locator is visible only in its reset position. Its pretty smooth now. I'm going to include your tooltips. Nice idea!
Gregory
On Sun, Jan 26, 2014, at 4:55 PM, Bob Hanlon <hanlonr357 at gmail.com> wrote:
> I don't know how to stop the giggle but this adds tooltips over the locators. I also changed the definition of the curve to be a more direct function of x.
>
> Manipulate[
> Module[
> {f, b, xmin = 0, xmax = 100},
> b = pt1[[2]] - m*pt1[[1]];
> f[{x1_, y1_}, x_] = (x1/x)^(a/(1 - a)) y1;
> pt2 = {pt2[[1]], m pt2[[1]] + b};
> Plot[{f[pt1, x], m x + b},
> {x, 0, 100},
> Epilog -> {White,
> Tooltip[Disk[pt1, {1, 2}], StringForm["pt1 = ``", pt1]],
> Tooltip[Disk[pt2, {1, 2}], StringForm["pt2 = ``", pt2]]},
> AxesOrigin -> {0, 0},
> PlotRange -> {{xmin, xmax}, {Automatic, 200}}]],
> {{a, .5, "Shape (a)"}, .2, .8, .01,
> Appearance -> "Labeled"},
> {{m, -1, "Slope (m)"}, -3, -.4, .01,
> Appearance -> "Labeled"},
> {{pt1, {10, 80}}, Locator},
> {{pt2, {50, 40}}, Locator}]
>
>
> Bob Hanlon
- References:
- Need Help With Locator in a Manipulate
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Need Help With Locator in a Manipulate