MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Asking PlotRange to take a Dynamic value

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98028] Re: Asking PlotRange to take a Dynamic value
  • From: Andrew <dr.a.graham at googlemail.com>
  • Date: Sat, 28 Mar 2009 05:43:17 -0500 (EST)
  • References: <gqfl0o$kra$1@smc.vnet.net> <gqiab6$oq5$1@smc.vnet.net>

On Mar 27, 10:38 am, dh <d... at metrohm.com> wrote:
> Hi Andrew,
>
> the whole Plot is dynamic, not simple the PlotRange. Therefore, put the
>
>   "Dynamic" around Plot, not around "z":
>
> Manipulate[
>
>   Dynamic@Plot[{Log[x], x^0.2, x^0.25, x^0.3}, {x, 0.01, n},
>
>     PlotStyle -> {Red, Blue, Blue, Blue},
>
>     PlotRange -> {{1, z}, {0, 55}}],
>
>   Style["Log[x] vs. \!\(\*SuperscriptBox[\"x\", \"a\"]\) for small \
>
> positive a 0.2, 0.25 & 0.3", 12, Bold],
>
>   Row[{Style["x", Bold], " from 1 to ",
>
>     PopupMenu[Dynamic[z], {10, 500, 10000, 500000}]}], {n, 0.1,
>
>    Dynamic[z], Appearance -> "Labeled"}]
>
> Allow me some criticism. I do not see the point of the manipulate, it
>
> simple hides part of the plot. Would it not make more sense, if you
>
> would "manipulate" e.g. the PlotRange and always draw the whole plot?
>
> Daniel
>
> Andrew wrote:
> > Hello,
>
> > I apologise in advance for what is probably a stupid question, but I
> > would appreciate some help in persuading PlotRange to take a Dynamic
> > value - or suggesting another way to go about things entirely!
>
> > For teaching purposes I wanted to draw a series of graphs of Log[x]
> > vs. x^a for small positive values of a at different scales (simply to
> > illustrate how Log[x] is eventually < x^a, for any positive a). I
> > thought I would use Manipulate to allow students to explore this
> > interactively.
>
> > E.g for x=0 to 10:
>
> > Manipulate[
> >  Plot[{Log[x], x^0.2, x^0.25, x^0.3}, {x, 0.001, n},
> >   PlotStyle -> {Red, Blue, Blue, Blue},
> >   PlotRange -> {{0, 10}, {0, 3}}],
> >  Style["Log[x] vs. \!\(\*SuperscriptBox[\"x\", \"a\"]\) for small \
> > positive a 0.2, 0.25 & 0.3", 12, Bold],
> >  Style["x = 0 to 10", 12, Bold], {n, 0.01, 10,
> >   Appearance -> "Labeled"}]
>
> > & for x=0 to 500,000:
>
> > Manipulate[
> >  Plot[{Log[x], x^0.2, x^0.25, x^0.3}, {x, 0.001, n},
> >   PlotStyle -> {Red, Blue, Blue, Blue},
> >   PlotRange -> {{0, 500000}, {0, 55}}],
> >  Style["Log[x] vs. \!\(\*SuperscriptBox[\"x\", \"a\"]\) for small \
> > positive a 0.2, 0.25 & 0.3", 12, Bold],
> >  Style["x = 0 to 500,000", 12, Bold], {n, 0.01, 500000,
> >   Appearance -> "Labeled"}]
>
> > But rather than a series of separate graphs I thought it would be more
> > elegant to combine them in one plot with a Dynamic value to choose the
> > scale, e.g.:
>
> > Manipulate[
> >  Plot[{Log[x], x^0.2, x^0.25, x^0.3}, {x, 0.01, n},
> >   PlotStyle -> {Red, Blue, Blue, Blue},
> >   PlotRange -> {{1, Dynamic[z]}, {0, 55}}],
> >  Style["Log[x] vs. \!\(\*SuperscriptBox[\"x\", \"a\"]\) for small \
> > positive a 0.2, 0.25 & 0.3", 12, Bold],
> >  Row[{Style["x", Bold], " from 1 to ",
> >    PopupMenu[Dynamic[z], {10, 500, 10000, 500000}]}], {n, 0.1,
> >   Dynamic[z], Appearance -> "Labeled"}]
>
> > Unfortunately, although the graphs will plot, with continually
> > updating axes, what I really want is to change the plot range for each
> > value of x & fix it so one can see the curves evolving more easily. I
> > hope the 2 individual examples above make it clear what I hoped for -
> > essentially, to click from one to the next with the PopupMenu. The
> > error message reads (e.g. for x=10):
>
> > Plot::prng: Value of option PlotRange -> {{1,10},{0,55}} is not All,
> > Full, Automatic, a positive machine number, or an appropriate list of
> > range specifications. >>
>
> > What's gone wrong? PlotRange -> {{1,10},{0,55}} looks like "an
> > appropriate list of range specifications" to me!
>
> > Any advice appreciated
>
> > Best regards
>
> > Andrew Graham

Jens-Peer, Daniel - thank you!

1) I'm a fool - of course, PlotRange -> {{1, z}, {0, 55}}, not
PlotRange -> {{1, Dynamic[z]}, {0, 55}}
2) Daniel, the aesthetic point is well taken

Much appreciated

Andrew


  • Prev by Date: Re: pdf export problem
  • Next by Date: Re: Re: Kernel is quitting on me
  • Previous by thread: Re: Asking PlotRange to take a Dynamic value
  • Next by thread: Solve problem