Re: Re: Possible bug in Opacity[] with plotting
- To: mathgroup at smc.vnet.net
- Subject: [mg105604] Re: [mg105595] Re: Possible bug in Opacity[] with plotting
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Fri, 11 Dec 2009 04:16:56 -0500 (EST)
- Reply-to: hanlonr at cox.net
You could also use Directive Plot[y, {x, 0, 144}, Filling -> Axis, FillingStyle -> Directive[Blue, Opacity[.5]], Frame -> True] Bob Hanlon ---- "Nasser M. Abbasi" <nma at 12000.org> wrote: ============= ----- Original Message ----- From: "Nasser M. Abbasi" <nma at 12000.org> To: <mathgroup at smc.vnet.net> Sent: Wednesday, December 09, 2009 7:42 PM Subject: [mg105604] [mg105595] Possible bug in Opacity[] with plotting function that uses UnitStep? > Version 7 on windows XP sp2. > > This is really a strange one, it seems like a "bug", but if not, then what > is it? > > I have a function defined with UnitStep[]. I plot it using Plot and using > Filling->Axis. > > The filling works ok across all the plot range even with different > FillingStyles for the color. > > But when I use Opacity[] to change the filling Style more, then only > _part_ of the plot is now affected by the Opacity[] and the other part is > not. > > Compare the following 2 plots to see: > > y = -400*UnitStep[x - 100.8] + 8*(x - 63.4)*UnitStep[x - 63.4] > -8*(x - 43.2)*UnitStep[x - 43.2] + 221.3 > > Plot[y, {x, 0, 144}, > Filling -> Axis, > FillingStyle -> {Opacity[0.5], Blue}, > Frame -> True] > > Plot[y, {x, 0, 144}, > Filling -> Axis, > FillingStyle -> Blue, > Frame -> True] > > --Nasser FYI; I have found how to do it. The trick is to use Opacity[.5,Blue] and NOT {Opacity[0.5], Blue} The following now works as expected. y = -400*UnitStep[x - 100.8] + 8*(x - 63.4)*UnitStep[x - 63.4] -8*(x - 43.2)*UnitStep[x - 43.2] + 221.3 Plot[y, {x, 0, 144}, Filling -> Axis, FillingStyle -> Opacity[.5,Blue], Frame -> True] Plot[y, {x, 0, 144}, Filling -> Axis, FillingStyle -> Blue, Frame -> True] I think writing {Opacity[0.5], Blue} instead of Opacity[.5,Blue] made it use the blue part for one part of the plot and Opacity[0.5] for another part. One more item added to my Mathematica cheat sheet. --Nasser