       Re: Asking PlotRange to take a Dynamic value

• To: mathgroup at smc.vnet.net
• Subject: [mg98005] Re: Asking PlotRange to take a Dynamic value
• From: dh <dh at metrohm.com>
• Date: Fri, 27 Mar 2009 05:38:50 -0500 (EST)
• References: <gqfl0o\$kra\$1@smc.vnet.net>

```
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!

>

>

> Best regards

>

> Andrew Graham

>

```

• Prev by Date: Re: HoldAll for Integrate
• Next by Date: Re: Re: Histograms and Iterators - Beginner Question
• Previous by thread: Re: Asking PlotRange to take a Dynamic value
• Next by thread: Re: Asking PlotRange to take a Dynamic value