MathGroup Archive 2009

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

Search the Archive

Re: Possible bug in Opacity[] with plotting function that uses UnitStep?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105618] Re: Possible bug in Opacity[] with plotting function that uses UnitStep?
  • From: Helen Read <hpr at together.net>
  • Date: Fri, 11 Dec 2009 04:19:33 -0500 (EST)
  • References: <hfqgmj$ol0$1@smc.vnet.net>

Nasser M. Abbasi wrote:
> 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]

This isn't a bug. In your first plot, you have specified two different 
styles for the filling, so it applies the first style, Opacity[0.5] to 
the part of the plot below the axis, and the second style, Blue, to the 
part of it that is above the axis. To specify a single style that has 
more than one property, use Directive, like this.

FillingStyle -> Directive[Opacity[0.5], Blue]

--
Helen Read
University of Vermont


  • Prev by Date: Re: Possible bug in Opacity[] with plotting function that uses UnitStep?
  • Next by Date: Re: Re: Manipulate a NDSolve equation is it possible
  • Previous by thread: Re: Possible bug in Opacity[] with plotting function that uses UnitStep?
  • Next by thread: CVS Install on Windows XP for Workbench