Re: Help in changing the vertical axis tick label format
- To: mathgroup at smc.vnet.net
- Subject: [mg76403] Re: Help in changing the vertical axis tick label format
- From: siewsk at bp.com
- Date: Mon, 21 May 2007 06:06:32 -0400 (EDT)
- References: <f2mcmh$kbu$1@smc.vnet.net>
Thanks everyone,
This is what I used now.
SciPlot2D[dp,fp,opt]
plots a 2D graph with Scientific Notation on the Vertical Axis. The
options are
dp The total number of decimal places. Must be greater than fp
fp The number of decimal places to the right of the decimal point.
opt The normal options for Plot[ ] function.
In[1]:=
SciPlot2D[dp_, fp_, opt__] := Module[{plot1, yTicks},
plot1 = Plot[opt, DisplayFunction -> Identity];
yTicks = (Ticks /. AbsoluteOptions[plot1, Ticks])[[2]] /.
{(y_)?NumericQ, (yLabel_)?NumericQ, {rr_, ll_}, r__} :>
{y, ScientificForm[yLabel, {dp, fp}, NumberPadding -> {"",
"0"}], {rr, rr},
r}; Show[plot1, Ticks -> {Automatic, yTicks}, DisplayFunction -
>
$DisplayFunction]]
In[2]:=
SciPlot2D[2, 1, x^3 - 6*x - 12, {x, -10, 10}, ImageSize -> {500,
400},
AspectRatio -> 4/5, PlotStyle -> {RGBColor[0., 0., 1],
Thickness[0.001]}];