Re: reverse an axis
- To: mathgroup at smc.vnet.net
- Subject: [mg4536] Re: [mg4437] reverse an axis
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Wed, 7 Aug 1996 04:17:42 -0400
- Sender: owner-wri-mathgroup at wolfram.com
TTCJ34A at 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 at haystack.demon.co.uk
==== [MESSAGE SEPARATOR] ====