Re: FrameTicks lengths

*To*: mathgroup at smc.vnet.net*Subject*: [mg81173] Re: [mg81113] FrameTicks lengths*From*: Carl Woll <carlw at wolfram.com>*Date*: Fri, 14 Sep 2007 03:44:48 -0400 (EDT)*References*: <200709131021.GAA15591@smc.vnet.net>

Kevin J. McCann wrote: >Is there a way to make the tick marks on a Framed plot longer than the >default without explicitly specifying the length for each tick? > >Thanks, > >Kevin > > You can use AbsoluteOptions or FullAxes to get the automatic ticks, and then modify them. The only problem is that AbsoluteOptions and FullAxes do not fully support the new version 6 graphics primitives and options. Anyway, here is a function I've used to do this: Options[LinearScale] = {"MinorTicks" -> True, "TickLength" -> 1, "TickExtent" -> "In", "TickLabels" -> True}; LinearScale[min_, max_, OptionsPattern[]] := Module[{minor, length, extent, labelpattern, ticks}, {minor, length, extent} = OptionValue[{"MinorTicks", "TickLength", "TickExtent"}]; extent = Switch[extent, "Out", Reverse, "Both", Reverse[#] + # &, _, Identity]; ticks = First[Ticks /. FullAxes[Graphics[{}, Ticks -> Automatic, PlotRange -> {{min, max}, Automatic}]] ]; If[minor, labelpattern = _, labelpattern = Except[""]]; Cases[ ticks, {x_, y : labelpattern, z_, w_} :> {x, If[OptionValue["TickLabels"], y, ""], length extent[z], w} ] ] And here is an example that uses LinearScale: Plot[Sin[x], {x, 0, 2 Pi}, Frame -> True, FrameTicks -> {LinearScale[0, 2 Pi, "TickLength" -> 3], LinearScale[-1, 1, "MinorTicks" -> False], LinearScale[0, 2 Pi, "TickLabels" -> False], LinearScale[-1, 1, "TickExtent" -> "Out"]}, PlotRangePadding -> None] Basically, the above FrameTicks option specifies that the bottom frame gets ticks that are 3 times as long, the left frame has no minor ticks, the top frame has no labels, and the right frame has the ticks sticking outside the frame. If you do not know the plot range before hand, then the process becomes a little more involved. Carl Woll Wolfram Research

**References**:**FrameTicks lengths***From:*"Kevin J. McCann" <Kevin.McCann@umbc.edu>