RE: LogPlot != Plot[Log]
- To: mathgroup at smc.vnet.net
- Subject: [mg24281] RE: [mg24266] LogPlot != Plot[Log]
- From: Wolf Hartmut <hwolf at debis.com>
- Date: Fri, 7 Jul 2000 00:11:24 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
> -----Original Message----- > From: Gy. Csanady [SMTP:csanady at gsf.de] To: mathgroup at smc.vnet.net > Sent: Thursday, July 06, 2000 5:11 AM > To: mathgroup at smc.vnet.net > Subject: [mg24266] LogPlot != Plot[Log] > > Dear Steve Christensen, > > I should like to post the following question to the Mathgroup. I am > relatively new with Mathematica and I encountered a problem.. > > > Dear MathGroup, > I should like to demonstrate some transformation rules graphically using > Mathematica extended capabilities. However, the simplest example failed: > Let assume a simple exponential function with real parameters: > > C1[t_] := C0*Exp[-kel*t] > > param = {C0 -> 100, kel -> 1} > > we can plot the function easily: > > g1 = Plot[C1[t] /. param, {t, 0, 2}, PlotRange -> {{0, 2}, {10, 100}}] > > > We can also make a half- logarithmic plot: > > g2 = Plot[Log[E, C1[t]] /. param, {t, 0, 2}, PlotStyle -> {RGBColor[0, 0, > 1], > Dashing[{0.05, 0.05}]}, PlotRange -> {{0, 2}, {Log[10], Log[100]}}] > > In addition we can convert the y-axis to a logarithmic one: > > g3 = Show[g2, Ticks -> Join[{FullOptions[g2, Ticks][[1]], FullOptions[g2, > Ticks][[2]] /. {x_, y_Real, len_, style_} :> {x, Exp[y], len, style}}]] > > We can obtain a half-logarithmic plot by using the LogPlot function: > > << Graphics`Graphics` > > g4 = LogPlot[C1[t] /. param, {t, 0, 2}, PlotRange -> {{0, 2}, {10, 100}}] > > Now I would expect that plot g4 and g3 become identic: > > Show[{g3, g4}, PlotRange -> All] > > But it is not the case. I am sure that there is something wrong. Any help > would be appreciated. > With best regards > Gy. Csanady > > [Wolf Hartmut] There is no mystery here, you only need base 10 for the logarithm. See In[9]:= g2a = Plot[Log[10, C1[t]] /. param, {t, 0, 2}, PlotStyle -> {RGBColor[1, 0, 1], Dashing[{0.05, 0.07}], Thickness[0.01]}, PlotRange -> {{0, 2}, {Log[10, 10], Log[10, 100]}}] In[10]:= g3a = Show[g2a, Ticks -> Join[{FullOptions[g2a, Ticks][[1]], FullOptions[g2a, Ticks][[2]] /. {x_, y_Real, len_, style_} :> {x, 10^y, len, style}}]] and then In[16]:= Show[{g4, g3a}] However In[15]:= g3d = Show[g2a, Ticks -> {Automatic, LogScale[1, 2]}] In[17]:= Show[{g3d, g4}] is less work! Kind regards, Hartmut Wolf