Re: Plotting Locators with Color
- To: mathgroup at smc.vnet.net
- Subject: [mg118181] Re: Plotting Locators with Color
- From: Gianluca Gorni <gianluca.gorni at uniud.it>
- Date: Fri, 15 Apr 2011 03:58:09 -0400 (EDT)
Isn't it funny that the default locator has the cross-hairs slightly off-center compared with the two circles? Have a look: Show[ToExpression[ StringReplace[ ToString[ CurrentValue[ FEPrivate`FrontEndResource["FEExpressions", "LocatorDefaultThumb"]][[1, 1, 1]]], "Box" -> ""]], Frame -> True, ImageSize -> 300] I wonder if this is intentional, to get somehow a better look at small sizes. Gianluca On 14/apr/2011, at 10.50, Alexander Elkins wrote: > 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 at aol.com> wrote in message > news:io17da$i4a$1 at 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 >> > > >