MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Frametick Orientation (2 Questions)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87590] Re: Frametick Orientation (2 Questions)
  • From: "D. Grady" <D.C.Grady at gmail.com>
  • Date: Mon, 14 Apr 2008 05:41:13 -0400 (EDT)
  • References: <ftmtqh$4je$1@smc.vnet.net>

Hi ouadad, regarding your first question, you could take a look at
this thread

http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/8402afa67d8ea11c/7895e434fd285f66?hl=en&tvc=2&q=Vertical+tick+la%3D+bels+in+BarChart#7895e434fd285f66

which describes an experimental feature you might find helpful.

Regarding your second question, yes it is possible.  It's even
possible without manually specifying a list of ticks.  Here's a
function that will do it:

frameTicksTransform[f_, graphic_, sides_: {1, 2, 3, 4}] :=
 Show[graphic,
  FrameTicks ->
   With[{ticksPos =
      Position[AbsoluteOptions@graphic, FrameTicks -> _]},
    With[{ticks =
       AbsoluteOptions[graphic][[
        Sequence @@ Flatten@Join[ticksPos, {2}]]]},
     MapAt[
      f,
      ticks,
      Flatten[
       Table[{side, i}, {side, sides}, {i, 1, Length[ticks[[side]]]}],
        1]
      ]]]]

This is kind of kludgy in the sense that you have to start with a
graphic that already has frame ticks; a better solution would let you
specify the way you want the ticks to look before it generates the
graphic.  This does seem to work fine, though.

In a graphic with frame ticks, each individual tick is specified by a
list that looks like

{position, label, {positiveLength, negativeLength}, directives}.

The frameTickTransform function takes as its first argument a function
that transform a single tick specification like above into what you
want it to look like.  The second argument is the graphic you want to
transform, and the third optional argument is the list of sides you
want the transform to apply to, which are numbered clockwise starting
from 1 at the bottom.  In your case, to make the frame ticks appear
outside the frame instead of inside, you just need to switch the
positiveLength and negativeLength for each tick.  For example, if g is
the graphic you gave as an example on April 11, you could write

frameTicksTransform[MapAt[Reverse, #, 3] &, g]

to get all the ticks outside the frame.  This is just saying that the
Reverse function should be mapped on to the third part of every tick
specification.  If you only want to flip the ticks on the bottom,

frameTicksTransform[MapAt[Reverse, #, 3] &, g, {1}]

Hope that this helps!

-Daniel


  • Prev by Date: Re: Cannot Factor an expression
  • Next by Date: Re: List concatenation speed
  • Previous by thread: Re: Frametick Orientation (2 Questions)
  • Next by thread: Path, Get, etc.