Re: Frameticks labels as numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg41785] Re: [mg41754] Frameticks labels as numbers
- From: Bobby Treat <drmajorbob-MathGroup3528 at mailblocks.com>
- Date: Thu, 5 Jun 2003 07:31:28 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
But the labels run over each other at the top of the frame, and they're not in a consistent format! Try this: lowerticks = Table[z, {z, 0, 2Pi, 1}]; upperticks = lowerticks /. x_?NumberQ :> {x, ScientificForm[x/2031.67, 2]}; Plot[Sin[x], {x, 0, 2Pi}, Frame -> True, FrameTicks -> {lowerticks, None, upperticks, None}, ImageSize -> 500] Bobby -----Original Message----- From: Howard Fink <howard.fink at nyu.edu> To: mathgroup at smc.vnet.net Subject: [mg41785] [mg41754] Frameticks labels as numbers A client requested ticks at the top of a plot to be in a numeric ratio to ticks at the bottom and vertically aligned. Here's what I came up with. You can label any tick with a text label. In upperticks, I created a list with the same values as lowerticks, calculated the ratio, then applied ToString to convert to text. lowerticks = Table[z, {z, 0, 2Pi, 1}]; upperticks = Apply [ToString, Table[{z, z/2031.67}, {z, 0, 2Pi, 1}], {2, 2}]; Plot[Sin[x], {x, 0, 2Pi}, Frame -> True , FrameTicks -> {lowerticks, None, upperticks, None}] Maybe it's trivial, (and apologies to the BIG BRAINS) but it involved a jaunt through the help browser stopping at Map, MapAt, Inner, Outer, Distribute, Thread, MapThread, and Apply, until I stopped and carefully counted to get the levelspec right. Howard Fink