Re: newby plotting question
- To: mathgroup at smc.vnet.net
- Subject: [mg22757] Re: [mg22711] newby plotting question
- From: BobHanlon at aol.com
- Date: Fri, 24 Mar 2000 03:28:03 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Each of these three methods are equivalent: Plot[{Sin[x], Cos[x], Sin[x] - Cos[x]}, {x, 0, 4Pi}, PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 1, 0], RGBColor[0, 0, 1]}]; p1 = Plot[Sin[x], {x, 0, 4Pi}, PlotStyle -> RGBColor[1, 0, 0], DisplayFunction -> Identity]; p2 = Plot[Cos[x], {x, 0, 4Pi}, PlotStyle -> RGBColor[0, 1, 0], DisplayFunction -> Identity]; p3 = Plot[Sin[x] - Cos[x], {x, 0, 4Pi}, PlotStyle -> RGBColor[0, 0, 1], DisplayFunction -> Identity]; Show[{p1, p2, p3}, DisplayFunction -> $DisplayFunction]; Show[{Plot[Sin[x], {x, 0, 4Pi}, PlotStyle -> RGBColor[1, 0, 0], DisplayFunction -> Identity], Plot[Cos[x], {x, 0, 4Pi}, PlotStyle -> RGBColor[0, 1, 0], DisplayFunction -> Identity], Plot[Sin[x] - Cos[x], {x, 0, 4Pi}, PlotStyle -> RGBColor[0, 0, 1], DisplayFunction -> Identity]}, DisplayFunction -> $DisplayFunction]; Bob Hanlon In a message dated 3/22/2000 1:56:01 AM, fschwiet at u.washington.edu writes: >I have three lists I want to plot on the same graph, in different colors. >My code went as follows: >(mean and var are lists of numbers, of the same length) > >p1 = ListPlot[ mean, PlotRange->All]; >p2 = ListPlot[ mean + Sqrt[var], > DefaultColor -> RGBColor[0,1,0], PlotRange->All]; >p3 = ListPlot[ mean - Sqrt[var], > DefaultColor -> RGBColor[1,0,0], PlotRange->All]]; >Show[p1,p2,p3]; > > >But this unfortunately draws p1, p2, and p3 on separate plots before drawing >all three on a single plot, and they were all black on the last plot anyhow. > >So I was clever, and came up with the following: > >Show[ > ListPlot[ mean, PlotRange->All], > ListPlot[ mean + Sqrt[var], > DefaultColor -> RGBColor[0,1,0], PlotRange->All], > ListPlot[ mean - Sqrt[var], > DefaultColor -> RGBColor[1,0,0], PlotRange->All]] > >Which produces the same result. ugh. Any advice? >