MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

FrameTicks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70137] FrameTicks
  • From: "Carabe - Fernandez, Alejandro" <a.carabe at imperial.ac.uk>
  • Date: Thu, 5 Oct 2006 03:32:34 -0400 (EDT)

Hi,
 
I have a problem with FrameTicks. All I am trying to do is to plot a
Log-Linear plot using data that was originally on a Log-Linear graph.
The data is given with errors and I have realised that MultipleListPlot
does not allow to produce Log-Linear plots. 
Please, see the attached file which contains the code I am using to
figure out how to do this.
 
Thank you - Alejandro

(*Please, copy and paste the following code on a new Mathematica window:
*)

<< Graphics`MultipleListPlot`;
<< Graphics`Graphics`;
<< DrawGraphics`DrawingMaster`

(*This is the data I have to plot, *)

datapoints = {{{0., 100.},ErrorBar[{-10.215, 10.215}]}, 
{{2., 82.93},ErrorBar[{-8.47, 8.47}]}, 
{{4., 74.12},ErrorBar[{-7.575, 7.575}]}, 
{{6., 50.97},ErrorBar[{-5.205, 5.205}]}, 
{{8., 45.56},ErrorBar[{-4.65, 4.65}]}, 
{{15.09, 22.37},ErrorBar[{-2.94, 2.94}]}, 
{{20., 20.37},ErrorBar[{-2.675, 2.675}]}, 
{{24.91, 15.67},ErrorBar[{-1.93, 1.93}]}, 
{{30., 14.27},ErrorBar[{-2.03, 2.03}]}, 
{{39.82, 7.27},ErrorBar[{-2.23, 2.23}]}, 
{{82.35, 5.2},ErrorBar[{-0.575, 0.575}]}, 
{{122.35, 3.3},ErrorBar[{-0.405, 0.405}]}, 
{{181.18, 3.03},ErrorBar[{-0.385, 0.385}]}, 
{{240., 2.28},ErrorBar[{-0.325, 0.325}]}, 
{{300., 1.82},ErrorBar[{-0.28, 0.28}]}, 
{{358.82, 1.53},ErrorBar[{-0.265, 0.265}]}}

Centerpoints = {{0., 100.}, {2., 82.93}, {4., 74.12}, {6., 50.97}, {8.,
45.56}, {15.09,22.37}, {20., 20.37}, {24.91, 15.67}, {30., 14.27},
{39.82, 7.27}, {82.35,5.2}, {122.35, 3.3}, {181.18, 3.03}, {240., 2.28},
{300., 1.82}, {358.82,1.53}}

plotData = LogListPlot[centerpoints, DefaultFont -> {"HelveticaBold",
18}, Frame -> True, PlotRange -> {{0, 400}, {1, 100}}, PlotStyle ->
{{RGBColor[0, 0, 1]}}, SymbolShape ->  {PlotSymbol[Box, 3]}, SymbolStyle
-> {GrayLevel[0]}, FrameLabel -> {"Repair Time (h)", "Reciprocal
proportion of Dsb/Gbp"}]

Clear[x]

plotFits = LogPlot[{100/((1 + 0.18510740896898217` x)),100
Exp[(-0.016617718366691753`) x],
83.69 Exp[(-0.0643) x] + 6.16 Exp[(-0.003963) x]}, {x, 0, 400},
DefaultFont -> {"HelveticaBold", 18}, Frame -> True, PlotStyle ->
{{RGBColor[1, 0, 0]}, {RGBColor[0, 0, 1]}, 
{RGBColor[0.5, 0, .5]}}, FrameLabel -> {"Repair Time (h)", "Dsb/Gbp"}]

thisIsThePlot = Show[plotData, plotFits]

(* The problem is that, if I want error bars to appear in this plot, I
have to use the MultipleListPlot[] command, but this command does not
allow to plot using Log-Linear scale, so I have found a different way to
do it by using the following code... *)

dataLogPoints = 
    datapoints /. {{x_, y_}, ErrorBar[{low_, high_}]} :> {x, Log[y]};

errorData = 
    datapoints /. {{x_, y_}, 
          ErrorBar[{low_, high_}]} :> {{x, Log[y + low]}, {x, Log[y +
high]}};

errorSymbol[width_][{{x_, low_}, {xdummy_, high_}}] :=
    {AbsoluteThickness[1.7], RGBColor[0, 0, 0], Line[{{x, low}, {x,
high}}],
      Line[{{x - width/2, low}, {x + width/2, low}}],
      Line[{{x - width/2, high}, {x + width/2, high}}]};

Clear[x, y];

Draw2D[{(* Draw the error symbols *)
errorSymbol[10] /@ errorData,

(* Draw the fitted curves *)
Draw[Log[100/(1 + 0.18510740896898217` x)], {x, 0, 400},PlotStyle ->
{RGBColor[1, 0, 0]}],
Draw[Log[100 Exp[-0.016617718366691753` x]], {x, 0, 400},PlotStyle ->
{RGBColor[0, 0, 1]}],
Draw[Log[83.69 Exp[-0.0643 x] + 6.16 Exp[-0.003963 x]], {x, 0,
400},PlotStyle -> {RGBColor[.5, 0, .5]}],

(* Draw the data points *)
PlotSymbol[Box, 3, Filled -> True] /@ dataLogPoints},
Frame -> True,
DefaultFont -> {"HelveticaBold", 18},
FrameLabel -> {"Repair Time (h)", "Dsb/Gbp"},
FrameTicks -> {Automatic, LogScale[-1, 2.73], None, None},
PlotRange -> All]


(*As you can see, my problem now is to adjust the FrameTicks (the
LogScale[] values to be more precise) to obtain the same scaling on the
Y-axis as I had in thisIsThePlot. Can you suggest what would be the
correct FrameTicks here??
Thank you*)




  • Prev by Date: Re: Symbol and Pi and expressions evaluating to Pi
  • Next by Date: RE:Dual Core
  • Previous by thread: Equilibrium points for 3 nonlinear ODE
  • Next by thread: RE: FrameTicks