I'm trying to apply a ColorFunction[]
to a piecewise plot. For some reason, applying the ColorFunction[]
to a plot results in aliasing artifacts (as seen in the image). Is there anyway to get rid of this?
(Mathematica 11.0)
cf[x_] := If[x <= 0, Black, Blue];
Rasterize[
Column[{
Plot[Piecewise[{{x^2, x >= 0}, {0, x < 0}}], {x, -2, 2},
ColorFunction -> cf, ImageSize -> Large],
Plot[Piecewise[{{x^2, x >= 0}, {0, x < 0}}], {x, -2, 2},
PlotStyle -> Blue, ImageSize -> Large]
}], ImageSize -> Large]
MeshShading
instead ofColorFunction
:Plot[Piecewise[{{x^2, x >= 0}, {0, x < 0}}], {x, -2, 2}, Mesh -> {{0}}, MeshShading -> {Black, Blue}]
to get this $\endgroup$