Re: Re: controlling the size of tick marks
- To: mathgroup at smc.vnet.net
- Subject: [mg16874] Re: [mg16863] Re: controlling the size of tick marks
- From: Richard S Hsu <rhsu at U.Arizona.EDU>
- Date: Mon, 5 Apr 1999 02:24:17 -0400
- Sender: owner-wri-mathgroup at wolfram.com
On Thu, 1 Apr 1999, P.J. Hinton wrote: > In article <7dsd1t$hks$6 at dragonfly.wolfram.com>, Mark Vaughn <mwv3776 at chenext1.tamu.edu> 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, > opts]]] > > 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.com > Wolfram Research, Inc. http://www.wolfram.com/~paulh/ > Disclaimer: Opinions expressed herein are those of the author alone. > Dear Mr. Hinton, I tried the example you gave and got a error message. In[1]:= 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, opts]]] In[2]:= Plot[Sin[x], {x, 0, 2Pi}, DisplayFunction -> enlargeTicks] Show::gmed: No graphics output medium specified. Richard