RE: make 1. x 10^-10 read simpl

• To: mathgroup at smc.vnet.net
• Subject: [mg8868] RE: [mg8479] make 1. x 10^-10 read simpl
• Date: Tue, 30 Sep 1997 20:16:32 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```Rob Peterson wrote:
|
|Seems like I am always losing graph space because the vertical axis is
|  labeled like "1. x 10^-10" (except the ^ isn't there).  I can't seem to
|  find a way to make it take up half the space by showing simply
|  "10^-10".
|

I have been working with Rob on his problem.  An example of a graphics Rob

In[1]:=
h = 6.63*^-34; k = 1.38*^-23; c = 3.0*^8;
c1 = 8*Pi*h*c; c2 = h*c/k;
(* BlackBodyDistr Black Body distr vs T and lambda  *)
rho[lambda_, T_] := c1/(lambda^5*(Exp[c2/lambda/T] - 1));
<<Graphics`Graphics`

In[2]:=
LogLogPlot[rho[lambda/10^6, 300], {lambda, 0.5, 100},
PlotRange -> All ];

Out[2]=    (*  Graphics not shown.  *)

The resulting graphic has TickMarks on the vertical axis labeled
1. x 10^-4,    1. x 10^-10,  1. x 10^-16,  etc.

Most would rather not have the "1. x" displayed.
I modified the standard package to produce better looking results (in my
opinion).

To do this I changed the definition of the LogTicks command in the
Graphics.m  package.
The change I made is shown below.  Please let me know If you think the code
should not be changed, or if there is a better way to get the desired
results.

Once Graphics.m  is modified as shown below, the commands above will produce
a graphics with TickMarks labeled as  10^-4,  10^-10,  10^-16,   etc.

Question:
What is the purpose of   NumberForm[x]
in the original code ?

Ted Ersek

_______________________________________

(*  The original definition was:   *)
LogTicks[x_] :=
{Log[10., x],NumberForm[x]}

(*  My new definition is:   *)
LogTicks[x_]:=
Module[{xx=MantissaExponent[N[x]], y=Rationalize[x]},
{Log[10. , x],
Which[
xx=={0.1, -1}, 0.01,
xx=={0.1, 0}, 0.1,
xx=={0.1, 1}, 1,
xx=={0.1, 2}, 10,
xx=={0.1, 3}, 100,
Part[xx, 1]==1.0, Superscript[10, Part[xx, 2]],
Part[xx, 1]==0.1, Superscript[10, Part[xx, 2]-1],
IntegerQ[y]&&(y<1000), y,
True, x
]
}
]
________________________________________
Note:
Under Windows 95 the Mma install program put the  Graphics.m  package in the
following folder: