MathGroup Archive 1999

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

Search the Archive

Re: controlling the size of tick marks

  • To: mathgroup at
  • Subject: [mg16863] Re: controlling the size of tick marks
  • From: paulh (P.J. Hinton)
  • Date: Thu, 1 Apr 1999 21:35:29 -0500
  • Organization: Wolfram Research, Inc.
  • References: <7cq4qo$> <7dsd1t$hks$>
  • Sender: owner-wri-mathgroup at

In article <7dsd1t$hks$6 at>, Mark Vaughn <mwv3776 at> writes:

> I'm satisfied with the default placement of tickmarks, what I want to do is to
> automatically make them e.g. twice as long.  Yea,  I could use FullOptions and
> get the tickmark list, apply a homebrew function or two in order to double their
> length, then rename the list and use it as new tick definition. However, this
> doesn't seem much better than what I do now: use the scaling command in Adobe
> Illutstrator on the saved .eps file.
> If I could apply a tick function direcly  in the options list, I would be much
> happier. I do not think the default size publishes well.

Unfortunately, you cannot access the tick mark generating function 
directly, but you can hide the procedure you describe above behind
an alternative display function.

Consider the following code snippet.  This is intended to be sample
code to get you started.  It's late, and I'm not really in the mood
for polishing. :-)

enlargeTicks[grObj_Graphics] := Module[{fulopts, tcklst}, 
   fulopts = FullOptions[grObj]; 
    tcklst = Ticks /. fulopts /. {loc_, lab_, len:{_, _}, 
        sty:{___}} -> {loc, lab, 2*len, sty}; 
    grObj /. Graphics[prims_, (opts__)?OptionQ] :> 
      Display[$Display, Graphics[prims, Ticks -> tcklst, 

It basically stretches the tick marks out in the positive and negative
directions by a factor of two.

Now, let's see how we apply this function.

Here is a simple plot that returns a Graphics object.

Plot[Sin[x], {x, 0, 2Pi}]

Now we switch the DisplayFunction option.

Plot[Sin[x], {x, 0, 2Pi}, DisplayFunction -> enlargeTicks]

This should cause a noticeable change in the vertical lengths of 
the ticks.

You could extend the enlargeTicks function to take arguments for
specifying positive and negative direction scaling factors.  You
could also extend it to other types of graphics objects so that
it could works as a drop-in replacement of $DisplayFunction.  Then
you wouldn't have to specify the DisplayFunction option in your
plotting or showing commands.  It would just work.

P.J. Hinton	
Mathematica Programming Group		paulh at
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.

  • Prev by Date: customizing Mathematica notebook styles (was Re: Mathematica Notebooks)
  • Next by Date: Re: Commutators and Operator Powers in Mathematica
  • Previous by thread: customizing Mathematica notebook styles (was Re: Mathematica Notebooks)
  • Next by thread: Re: Re: controlling the size of tick marks