Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #1666
| From | "Alexander Elkins" <alexander_elkins@hotmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Plotting Locators with Color |
| Date | 2011-04-14 09:00 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <io6d2h$dqp$1@smc.vnet.net> (permalink) |
| References | <io17da$i4a$1@smc.vnet.net> |
The appearance of the default locator is defined in
"SystemFiles\FrontEnd\TextResources\MiscExpressions.tr".
There are two default definitions, "LocatorDefaultThumb" and
"LocatorDefaultThumbDisabled", the one that is chosen depends
on the locator's Enabled option.
You can use:
InputForm[
ToExpression[
StringReplace[
ToString[
CurrentValue[
FEPrivate`FrontEndResource["FEExpressions",
"LocatorDefaultThumb"]][[1, 1, 1]]], "Box" -> ""]]]
to get the basic locator appearance to start with:
Graphics[{{AbsoluteThickness[1], Antialiasing -> False,
Line[{{{0, -10}, {0, -2}}, {{0, 2}, {0, 10}}, {{-10, 0}, {-2, 0}},
{{2, 0}, {10, 0}}}], Antialiasing -> True, Circle[{-0.5, 0.5}, 5]},
{AbsoluteThickness[3], Opacity[0.3], Circle[{-0.5, 0.5}, 3]}},
ImageSize -> 17,
PlotRange -> {{-8, 8}, {-8, 8}}]
Here is your example using colored locators:
Needs["Splines`"]
Manipulate[
LocatorPane[pts; Dynamic@pts,
Dynamic@Graphics[{Spline[pts, Bezier]}, Axes -> True,
AxesLabel -> {x, y}, PlotRange -> {{-3, 3}, {-3, 3}},
Background -> LightOrange],
Appearance ->
Table[Graphics[{c, {AbsoluteThickness[1], Antialiasing -> False,
Line[{{{0, -10}, {0, -2}}, {{0, 2}, {0, 10}}, {{-10, 0}, {-2,
0}}, {{2, 0}, {10, 0}}}], Antialiasing -> True,
Circle[{-0.5, 0.5}, 5]}, {AbsoluteThickness[3], Opacity[0.3],
Circle[{-0.5, 0.5}, 3]}}, ImageSize -> 17,
PlotRange -> {{-8, 8}, {-8, 8}}], {c, {Blue, Red, Green,
Brown}}]], {{pts, {{0, 0}, {0, 2}, {2, 0}, {2,
2}}}, {-3, -3}, {3, 3}, ControlType -> None},
SaveDefinitions -> True, Initialization :> {Needs["Splines`"]},
AutorunSequencing -> {2}]
Please note the same result can be achieved in Manipulate without using
LocatorPane and Dynamic as follows:
Needs["Splines`"]
Manipulate[
Graphics[{Spline[pts, Bezier]}, Axes -> True,
AxesLabel -> {"x", "y"}, PlotRange -> 3,
Background ->
LightOrange], {{pts, {{0, 0}, {0, 2}, {2, 0}, {2, 2}}}, Locator,
Appearance ->
Table[Graphics[{c, {AbsoluteThickness[1], Antialiasing -> False,
Line[{{{0, -10}, {0, -2}}, {{0, 2}, {0, 10}}, {{-10, 0}, {-2,
0}}, {{2, 0}, {10, 0}}}], Antialiasing -> True,
Circle[{-0.5, 0.5}, 5]}, {AbsoluteThickness[3], Opacity[0.3],
Circle[{-0.5, 0.5}, 3]}}, ImageSize -> 17,
PlotRange -> {{-8, 8}, {-8, 8}}], {c, {Blue, Red, Green,
Brown}}]}]
Enjoy!
"Bill" <WDWNORWALK@aol.com> wrote in message
news:io17da$i4a$1@smc.vnet.net...
> Hi:
>
> I'm using Mathematica 8.0.1. on a PC with the following code:
>
> Manipulate[
> LocatorPane[pts; Dynamic@pts,
> Dynamic@Graphics[{Spline[pts, Bezier]}, Axes -> True,
> AxesLabel -> {x, y}, PlotRange -> {{-3, 3}, {-3, 3}},
> Background -> LightOrange]], {{pts, {{0, 0}, {0, 2}, {2, 0}, {2,
> 2}}}, {-3, -3}, {3, 3}, ControlType -> None},
> SaveDefinitions -> True, Initialization :> {Needs["Splines`"]},
> AutorunSequencing -> {2}]
>
> How can I plot this with each locator plotted in a different color?
>
>
> Thanks,
>
> Bill
>
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Plotting Locators with Color Bill <WDWNORWALK@aol.com> - 2011-04-12 09:52 +0000 Re: Plotting Locators with Color Peter Pein <petsie@dordos.net> - 2011-04-13 09:54 +0000 Re: Plotting Locators with Color "Alexander Elkins" <alexander_elkins@hotmail.com> - 2011-04-14 09:00 +0000
csiph-web