Re: 2 ticks on a 2D plot

*To*: mathgroup at smc.vnet.net*Subject*: [mg14556] Re: 2 ticks on a 2D plot*From*: "Allan Hayes" <hay at haystack.demon.co.uk>*Date*: Fri, 30 Oct 1998 03:07:28 -0500*References*: <70418l$i5k@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

H. J. Wang wrote in message <70418l$i5k at smc.vnet.net>... >Hi, > >Is there a way to have two different ticks on a 2D plot, one on the top >and the other on the bottom of a frame? > >I am trying to plot 2 lists of data on a single picture. They have the >same y-axis scale but different x-axis scales. Ideally I would like to >put them in a frame, and give each list a separate x-axis; one on the >top and the other on the bottom, which looks like (the box will be >twisted if this message is displayed with proportional fonts): > > 1 2 3 4 5 > -------------- > 3| | > 2| | > 1|____________| > 1 2 3 4 > > >Any advice will be appreciated! > >H.J. Wang > Some ideas: We combine: Plot[x^2, {x, 0, 1},Frame -> True, FrameTicks -> Automatic]; Plot[Sin[x], {x, Pi/2, 2Pi}, Frame -> True, FrameTicks -> Automatic]; A scaling function and its inverse are needed sc = Interpolation[{{0, Pi/2}, {1, 2Pi}}]; invsc = Interpolation[{{Pi/2, 0}, {2Pi, 1}}]; Now (with the second plot and its ticks in red), Plot[{x^2, Sin[sc[x]]}, {x, 0, 1}, PlotStyle -> {{GrayLevel[0]}, {Hue[0]}}, Frame -> True, FrameTicks -> {Automatic, Automatic, Table[{invsc[#], StyleForm[#, FontColor -> Hue[0]]} &[i], {i, 2, 6}], None}] ---------------------- Allan Hayes Mathematica Training and Consulting www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565