       Re: Re: Reversing the axis of a plot

• To: mathgroup at smc.vnet.net
• Subject: [mg15174] Re: [mg15153] Re: Reversing the axis of a plot
• From: BobHanlon at aol.com
• Date: Thu, 17 Dec 1998 00:27:51 -0500
• Sender: owner-wri-mathgroup at wolfram.com

```In a message dated 12/16/98 8:28:40 AM, JOHN_C_ERB at prodigy.net writes:

>Perhaps a misunderstanding.
>
>I wish to reverse one of the axes, rather than to switch axes. For
>example, the y-axis would remain the y-axis, and would range from 0 to
>5, and the x-axis would remain the x-axis; however, the x-axis would
>now range from 5 to 0 (with the plot reversed), as one goes from left
>to right along the axis.
>

John,

This is an approach
_______________________

reversePlot[func_, {var_Symbol, val1_?NumericQ,
val2_?NumericQ}, opts___] :=
Module[{x, varmin = Min[val1, val2], varmax = Max[val1, val2]},
Plot[func /. var :> (-x + varmin + varmax),
{x, varmin, varmax},
Ticks -> {Table[{x, ToString[N[varmax+varmin-x]]},
{x, varmin, varmax, (varmax-varmin)/5}], Automatic},
opts]]

Plot[3x^2+2x+5, {x, 2, 4}, PlotStyle -> RGBColor[1, 0, 0]];

reversePlot[3x^2+2x+5, {x, 2, 4}, PlotStyle -> RGBColor[1, 0, 0]];

Plot[Exp[x], {x, -1, 2}, PlotStyle -> RGBColor[1, 0, 0]];

reversePlot[Exp[x], {x, -1, 2}, PlotStyle -> RGBColor[1, 0, 0]];
_________________________

The tick labeling could use some work.

Bob Hanlon

```

• Prev by Date: Re: NIntegrate of a Decaying Exponential
• Next by Date: Re: NIntegrate of a Decaying Exponential
• Previous by thread: Re: Re: Reversing the axis of a plot
• Next by thread: Re: Reversing the axis of a plot