Re: Re: Re: controlling the size of tick marks
- To: mathgroup at smc.vnet.net
- Subject: [mg27646] Re: [mg27577] Re: [mg16925] Re: controlling the size of tick marks
- From: BobHanlon at aol.com
- Date: Fri, 9 Mar 2001 02:36:04 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Look at the built-in Tick specifications for any Plot
(Ticks /. AbsoluteOptions[
Plot[x, {x, 0, 1}, DisplayFunction -> Identity]])[[1]]
You need only add a revised AbsoluteThickness to the previous modification
enlargeTicks[grObj:Blank[Graphics]] :=
Module[{fulopts, tcklst}, fulopts = FullOptions[grObj];
tcklst = Ticks /.
fulopts /. {loc_, lab_, len:{_, _}, sty:{___}} -> {loc, lab, 2*len,
sty /. AbsoluteThickness[d_] -> AbsoluteThickness[2d]};
grObj /. Graphics[prims_, (opts__)?OptionQ] :>$DisplayFunction[
Graphics[prims, Ticks -> tcklst, opts]]]
Compare
Plot[Sin[x], {x, 0, 2Pi}];
Plot[Sin[x], {x, 0, 2Pi}, DisplayFunction -> enlargeTicks];
Bob Hanlon
In a message dated 2001/3/7 4:48:09 AM, mag5 at duke.edu writes:
>I'm trying make the tick marks thicker, not just longer. I'm a rather
>
>limited mathematica programmer, so I can't figure out how to modify the
>
>function below to get thicker tick marks (as well as longer).
>
>Can anyone help me out here?
>
>Much appreciated,
>
>Mike
>
>On Thu, 8 Apr 1999, P. J. Hinton wrote:
>>
>>On 6 Apr 1999, Richard S Hsu wrote:
>>
>> > 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.
>>
>> The source of this user's problem was that I had negelected to test this
>> code with a shell-based interface, where motifps would be rendering the
>> PostScript rather than the notebook front end. In that case, $Display
>
>>is
>> set to not set in such a way that this method will function properly.
>>
>> Here is a rewrite of the code that should work with both methods.
>>
>> enlargeTicks[grObj:Blank[Graphics]] :=
>> Module[{fulopts, tcklst}, fulopts = FullOptions[grObj];
>> tcklst = Ticks /. fulopts /.
>> {loc_, lab_, len:{_, _}, sty:{___}} -> {loc, lab, 2*len, sty};
>> grObj /. Graphics[prims_, (opts__)?OptionQ] :>
>> $DisplayFunction[Graphics[prims, Ticks -> tcklst, opts]]]
>