Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Re: [mg4437] reverse an axis
Replies: 0

 Allan Hayes Posts: 1,508 Registered: 12/6/04
Re: [mg4437] reverse an axis
Posted: Jul 30, 1996 3:00 AM

TTCJ34A@prodigy.com (DR JOHN C ERB)
[mg4437] reverse an axis
writes,
>Is it possible to reverse an axis. I am doing some work with
> ListContourPlot and I would like for my x-axis to display from say
> 14 to -5 (from left to right across the screen), while the y-axis
> goes from say 2 to 9.
> I have tried calculating my data matrix "backwards" in the x-
> direction,and using MeshRange->{{14,-5},{2,9}}; this does not

work > (the data is now "backwards" but the x-axis still displays
from -5 > to 14).

John,
The following hack may help

data = Transpose[Table[x, {x,-3,1,.25}, {y,-2,2,.5}]];
rdata = Reverse/@data;
lcp = ListContourPlot[rdata, MeshRange -> {{-3,1},{-2,2}}]
ot = FullOptions[Graphics[lcp],FrameTicks]/.{a_,b_} :> Cases[a,
{p_,l_?NumberQ, r__}:> {p,l}]

{{1., 1.}, {0., 0}, {-1., -1.}, {-2., -2.}, {-3., -3.}}

rot = Transpose[MapAt[Reverse, Transpose[ot],{2}]]

{{1., -3.}, {0., -2.}, {-1., -1.}, {-2., 0}, {-3., 1.}}

Show[lcp, FrameTicks ->{rot, Automatic}]

Allan Hayes
hay@haystack.demon.co.uk