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.