MathGroup Archive 2007

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

Search the Archive

Re: framed plots with two y axes scales

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80277] Re: framed plots with two y axes scales
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Thu, 16 Aug 2007 04:50:15 -0400 (EDT)
  • References: <f9mrf7$sbt$1@smc.vnet.net>

On Aug 12, 6:38 am, Bill Rowe <readnews... at sbcglobal.net> wrote:
> On 8/9/07 at 5:28 AM, ch... at chiasson.name (ChrisChiasson) wrote:
>
>
>
> >In the old version of Mathematica, I used David Park's Draw Graphics
> >package to obtain graphs with two y axes scales. I was successful in
> >making these graphs without the package in the new version, but my
> >technique involves a lot of code. Is there a cleaner way, such as
> >being able to specify a scaling factor between both sides?
> >Simple example: Height of a ball thrown straight up in a
> >gravitational field with some initial velocity and no drag:
> >plotExpr=h@t/.DSolve[m h''@t==-m
> >g&&h'@0==v0&&h@0==0,h,t]/.{g->9.80665,v0->10}
> >labelRightAxisTicks=Function[gr,With[{frameTicks=FrameTicks/.
> >AbsoluteOptions[gr,FrameTicks],cf=3.2808},Show[gr,
> >FrameTicks->Append[Drop[frameTicks,-1],{#1,If[#2=!="",SetPrecision[#
> >1 cf,3],""],##3}&@@@frameTicks[[2]]]]]]
> >Plot[Evaluate@plotExpr,{t,0,2},Frame->True,FrameLabel->{"t (s)","h
> >(m)",None,"h (ft)"}] labelRightAxisTicks@%
> >Also, I suspect a subtle error in my code because the tick marks are
> >not the size they should be (relative to the plot area).
>
> Your code seems overly complex to me. The following seems much
> less complex to me and looks like it does what you want
>
> Plot[1/2 (20 t - 9.80665 t^2), {t, 0, 2}, Frame -> True,
>   FrameLabel -> {"t(s)", "h(m)", "", "h(ft)"},
>   FrameTicks -> {Automatic, Automatic,
>     None, {.3048 #, #} & /@ Range[0, 16, 2]}]
> --
> To reply via email subtract one hundred and four

The difference is that you manually specified where the tick marks
went while mine are automatically extracted from the graphic (which I
am sure you realize).



  • Prev by Date: Re: Serious Problem with GridLines
  • Next by Date: Re: Evaluating a convolution integral in Mathematica
  • Previous by thread: Re: framed plots with two y axes scales
  • Next by thread: Re: framed plots with two y axes scales