Re: DiscretePlot filling is darker above axis than below
- To: mathgroup at smc.vnet.net
- Subject: [mg121326] Re: DiscretePlot filling is darker above axis than below
- From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
- Date: Sat, 10 Sep 2011 07:30:18 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j4cnjh$hjr$1@smc.vnet.net>
On Fri, 09 Sep 2011 10:51:45 +0100, Christopher O. Young
<cy56 at comcast.net> wrote:
> Can't seem to get the filling to come out the same darkness above and
> below
> the axis.
>
> Show[
> DiscretePlot[
> Sin[t], {t, 0, 2 \[Pi], \[Pi]/6},
> ExtentSize -> \[Pi]/12,
> PlotStyle -> {Red, Opacity[0.5]},
> Filling -> Axis,
> FillingStyle -> {Red, Opacity[0.5]}
> ],
> Plot[Sin[t], {t, 0, 2 Pi}
> ]
> ]
>
According to the documentation of DiscretePlot,
Filling -> Axis, FillingStyle -> {Red, Opacity[0.5]}
means that bars above the axis will be red, and bars below will be 50%
opaque. If you want them to be both red and 50% opaque regardless of
position above or below the axis, you should use
Directive[Red, Opacity[0.5]]
although using this Directive for both PlotStyle and FillingStyle results
in 75% opaque regions where the fill and markers are drawn on top of one
another. Ordinarily one would solve this by specifying PlotStyle -> None,
but for some reason DiscretePlot does not respond to this setting, and so
we must draw completely transparent plot markers to get the same effect:
Show[
DiscretePlot[
Sin[t], {t, 0, 2 \[Pi], \[Pi]/6},
ExtentSize -> \[Pi]/12,
PlotStyle -> Opacity[0],
Filling -> Axis,
FillingStyle -> Directive[Red, Opacity[0.5]]
],
Plot[Sin[t], {t, 0, 2 Pi}
]
]