The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

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

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

Advanced Search

Back to Topic List Back to Topic List  
Allan Hayes

Posts: 1,508
Registered: 12/6/04
Re: [mg4437] reverse an axis
Posted: Jul 30, 1996 3:00 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply (DR JOHN C ERB)
[mg4437] reverse an axis
>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).

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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.