Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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

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







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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.