Re: double labelled y axis in graphs
- To: mathgroup at smc.vnet.net
- Subject: [mg21253] Re: [mg21218] double labelled y axis in graphs
- From: "Tomas Garza" <tgarza at mail.internet.com.mx>
- Date: Mon, 20 Dec 1999 02:28:14 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Charles A. Judge M.D. (Pyrtr [nospamme at nonet.net]) wrote: > Does anyone know of a way to put 2 y axes on 1 graph. I need to > present data > on the y axis and refer to it with 2 equivalent scales.. i.e. > degrees F and > degrees C for example. > > I could have 2 y axes .. 1 on each side of the graph labelled > appropriately, > or have 2 scales on a single y axis on the left side of the graph. The following example will give you an idea about what to do in this case. In[1]:= g1 = Plot[Sin[x], {x, -Pi, Pi}, PlotStyle -> RGBColor[1, 0, 0], DisplayFunction -> Identity]; In[2]:= g2 = Plot[2*Sin[x], {x, -Pi, Pi}, PlotStyle -> RGBColor[0, 0, 1], DisplayFunction -> Identity]; In[3]:= leftTicks = {{-2, StyleForm["- Two", FontColor -> RGBColor[1, 0, 0]]}, {-1, StyleForm["- One", FontColor -> RGBColor[1, 0, 0]]}, {0, StyleForm["Zero", FontColor -> RGBColor[1, 0, 0]]}, {1, StyleForm["One", FontColor -> RGBColor[1, 0, 0]]}, {2, StyleForm[" Two", FontColor -> RGBColor[1, 0, 0]]}}; In[4]:= rightTicks = {{-2, StyleForm["- Four", FontColor -> RGBColor[0, 0, 1]]}, {-1, StyleForm["- One", FontColor -> RGBColor[0, 0, 1]]}, {0, StyleForm["Zero", FontColor -> RGBColor[0, 0, 1]]}, {1, StyleForm["Two", FontColor -> RGBColor[0, 0, 1]]}, {2, StyleForm[" Four", FontColor -> RGBColor[0, 0, 1]]}}; In[5]:= Show[g1, g2, Frame -> True, FrameTicks -> {Automatic, leftTicks, None, rightTicks}, DisplayFunction -> $DisplayFunction] (Graph not shown here) You may refer to the on-line browser on FrameTicks. Tomas Garza Mexico City