Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1637 > unrolled thread

Plotting Locators with Color

Started byBill <WDWNORWALK@aol.com>
First post2011-04-12 09:52 +0000
Last post2011-04-14 09:00 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  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

#1637 — Plotting Locators with Color

FromBill <WDWNORWALK@aol.com>
Date2011-04-12 09:52 +0000
SubjectPlotting Locators with Color
Message-ID<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

[toc] | [next] | [standalone]


#1650

FromPeter Pein <petsie@dordos.net>
Date2011-04-13 09:54 +0000
Message-ID<io3rsk$1q3$1@smc.vnet.net>
In reply to#1637
Am 12.04.2011 11:52, schrieb Bill:
> 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
>

Hi,

the first of the "Neat Examples" for LocatorPane shows a possible way:
add the Option  Appearance -> Table[Style["\[FilledCircle]", Hue[i/5]], 
{i, 4}]. This gives dots in place of the standard locator.

hth,
Peter

[toc] | [prev] | [next] | [standalone]


#1666

From"Alexander Elkins" <alexander_elkins@hotmail.com>
Date2011-04-14 09:00 +0000
Message-ID<io6d2h$dqp$1@smc.vnet.net>
In reply to#1637
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
>


[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web