Re: Plot & BoldPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg17067] Re: Plot & BoldPlot
- From: Bernd Brandt <bernd at bio.vu.nl>
- Date: Wed, 14 Apr 1999 02:12:09 -0400
- Organization: VU Biology, Amsterdam, The Netherlands
- References: <7ehktv$o09@smc.vnet.net> <7es3i1$ccj@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, The example code of Allan and Ted work fine. Thanks Allan and Ted!! Unfortunately Mathematica print a decimal point (".") after the integer tick labels. 1 becomes 1. 2 becomes 2. etc (already in FullOptions[gr, Ticks]). Does anyone know why Mathematica gives a different label in FullOption[gr,Ticks] than it actually uses when drawing "gr" ?? To prevent the printing of the decimal points after integer valuesI changed "lab" in the code below into If[MatchQ[Rationalize[lab], Rational[_,_]], lab, Rationalize[lab] ] (Seems strange to me having to do this.) Below the code of Ted with changed including the above mentioned change. regards, Bernd ======================================================================= enlargeTicks[grObj_Graphics]:= Module[{fulopts, tcklst}, fulopts = FullOptions[grObj]; tcklst = Ticks/.fulopts /. {loc_,lab_,len:{_,_},{a___,AbsoluteThickness[_],b___}}:> {loc, If[MatchQ[Rationalize[lab], Rational[_,_]], lab , Rationalize[lab] ], 1.5*len,{a,AbsoluteThickness[2],c}}; grObj/.Graphics[prims_,(opts__)?OptionQ]:> Graphics[prims,Ticks->tcklst,opts] ] BoldPlot[f_,PlotRange_,opts___?OptionQ]:= Module[{gr,df}, df=DisplayFunction/.Flatten[{opts,Options[Plot]}]; gr=Plot[f,PlotRange, DisplayFunction->Identity, opts, PlotStyle->{AbsoluteThickness[2]}, AxesStyle->{AbsoluteThickness[2]}, TextStyle->{FontWeight->"Bold"} ]; Show[enlargeTicks[gr],DisplayFunction->df] ] gr=BoldPlot[Sin[x],{x,0,4 Pi}];