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


Groups > comp.soft-sys.math.mathematica > #12914

Re: vertical line tied to slider

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: vertical line tied to slider
Date 2012-12-21 10:38 +0000
Message-ID <kb1e6s$ova$1@smc.vnet.net> (permalink)
References <20121220082138.1845D690D@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


To avoid cluttering the chart, I recommend using a sliding point
rather than a sliding line. However, if you prefer, just replace the
Point in the Epilog with a Line[{{{year}, 0}, {{year}, 8000}}].
Although, if you use a line I would use a Prolog rather than an
Epilog.

Manipulate[
 curve := {3320, 3540, 3913, 4296, 4592,
   4829, 5035, 5803, 7545, 3320, 3540,
   3913, 4296, 4592, 4829, 5035, 5803,
   7545, 4829, 5035, 5803, 6000};
 DateListPlot[
  {Tooltip[curve, "Curve"]}, {2001},
  PlotStyle -> {{AbsoluteThickness[2], Black}},
  AspectRatio -> 1/2,
  BaseStyle -> {
    FontWeight -> "Bold",
    FontSize -> 12,
    Purple},
  GridLines -> {
    List /@ Range[2005, 2020, 5],
    Range[0, 8000, 1000]},
  GridLinesStyle -> Directive[Orange, Dashed],
  Joined -> True,
  PlotRange -> {{{2000, 10, 1}, {2022, 3, 1}}, {0, 8000}},
  ImageSize -> 504,
  Frame -> True,
  FrameLabel -> {"YEAR", "BILLIONS"},
  Epilog -> {
    Red,
    AbsolutePointSize[6],
    Tooltip[
     Point[
      {{year, 1, 1}, curve[[year - 2000]]}],
     {year, curve[[year - 2000]]}]}],
 Row[{
   Control[
    {{year, 2001, "Year"}, 2001, 2022, 1,
     Appearance -> {"Labeled", "Open"}, ImageSize -> Large}],
   Spacer[10],
   Button[Reset, {year = 2001, default = False} &]}],
 TrackedSymbols -> All]


Bob Hanlon


On Thu, Dec 20, 2012 at 3:21 AM, Joe <design@rcn.com> wrote:
> This ParametricPlot is supposed to create a vertical line that moves with the slider. Other curves, sliders, Grids, etc. have been removed (while retaining problem) to simplify analysis.
>
> I have another application where the ParametricPlot of a vertical line works perfectly with a slider.  The one difference that may be significant is that this Show includes a DateListPlot whereas the other uses a Plot.
>
> Basically, I am looking for the simplest vertical line that will track the slider.
>
> I have tried everything I can think of.  A solution or any ideas will be appreciated......  Thank you...
>
> design@rcn.com
> Gaithersburg, MD
>
> Manipulate[
>  curve := {3320, 3540, 3913, 4296, 4592, 4829, 5035, 5803, 7545, 3320, 3540,
>    3913, 4296, 4592, 4829, 5035, 5803, 7545, 4829, 5035, 5803, 6000};
>  Column[{
>    Show[
>     DateListPlot[
>      {Tooltip[curve, "Curve"]
>       }, {2001},
>      PlotStyle -> {{AbsoluteThickness[3], Black}},
>      AspectRatio -> 1/2,
>      BaseStyle -> {FontWeight -> "Bold", FontSize -> 12, Purple},
>      GridLines -> {{"2005", "2010", "2015", "2020"}, Range[0, 8000, 1000]},
>      GridLinesStyle -> Directive[Orange, Dashed],
>      Joined -> True,
>      PlotRange -> {{"2001", "2022"}, {0, 8000}},
>      ImageSize -> {800, 400},
>      Frame -> True,
>      FrameLabel -> {YEAR, BILLIONS}
>      ],          (* DateListPlot *)
>     ParametricPlot[
>      Tooltip[{{n}, {year, n}}], {n, 0, 8000},
>      PlotStyle -> {{Orange, AbsoluteThickness[4]}}
>      ]            (* ParametricPlot *)
>     ]            (* Show Box *)
>    }],         (* Column Box*)
>  {{year, 2001,"Year\n\n\n\n"}, 2001, 2022, 1, ControlPlacement -> Left,
>   Appearance -> {"Open", Small}},
>  Button[Reset, {year = 2001, default = False} &],
>  TrackedSymbols -> All
>  ]           (* Manipulate Box*)
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: vertical line tied to slider Bob Hanlon <hanlonr357@gmail.com> - 2012-12-21 10:38 +0000

csiph-web