Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Two y-axes in one graph

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52134] Re: [mg52080] Two y-axes in one graph
  • From: "David Annetts" <davidannetts at ihug.com.au>
  • Date: Thu, 11 Nov 2004 04:53:37 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Harry,

> but the suggested function TwoAxisPlot doesn't exist:

So create it ....  It's defined right there on the page.  

In the event that you see a picture placeholder, copy the following

(* from here *)
Needs["Graphics`MultipleListPlot`"]

TwoAxisListPlot[f_List, g_List, frange_, grange_, opts___?OptionQ] :=
   Module[{old, new, scale, fm, fM, gm, gM, newg},
    {fm, fM} = frange;
    {gm, gM} = grange;
    scale[var_] = ((var - gm)*(fM - fm))/(gM - gm) + fm  ;
       old = AbsoluteOptions[ListPlot[g, Frame -> True, PlotRange -> grange,
         DisplayFunction -> Identity], FrameTicks][[1, 2, 2]];
       new = (Prepend[Rest[#1], scale[First[#1]]] & ) /@ old;
       newg = Transpose[{Transpose[g][[1]],
         Map[scale, Transpose[g][[2]], {1, 2}]}];
       MultipleListPlot[f,   newg, Frame -> True,
         FrameTicks -> {Automatic, Automatic, None, new},
         SymbolStyle -> {{RGBColor[1, 0, 0]}, {RGBColor[0, 0, 1]}},
         FrameStyle -> {{}, {RGBColor[1, 0, 0]}, {},
           {RGBColor[0, 0, 1]}}, PlotRange -> frange + .05 (fM - fm), opts]]

(* to here *)

>   In[1]:= ?TwoAxisPlot
>           Information::notfound: Symbol TwoAxisPlot not found.
> 
> Do I have to load a package to use it?

You have to create it.

Regards,

Dave.



  • Prev by Date: Fibonacci based sum that is b-normal on binary numbers
  • Next by Date: Re: First question
  • Previous by thread: Re: Two y-axes in one graph
  • Next by thread: Re: Two y-axes in one graph