I'm finding strange behavior with ColorFunction. Say I want to color a plot to indicate the sign of abscissa (this is a simplification of a more complex plot I'd like to do):
Plot[
Log[Abs[x]],
{x, -2, 2},
ColorFunction -> Function[{x, y}, Hue[\[Piecewise] {
{0.7, x > 0},
{0.0, x <= 0}
}]]
]
It doesn't color the negative branch red as I would like, although if you look closely it colors the very first point red:
It also doesn't work for the second argument either, and I don't understand the behavior:
Plot[
Floor[x],
{x, -2, 2},
ColorFunction -> Function[{x, y}, Hue[\[Piecewise] {
{0.7, y > 0},
{0.0, y < 0}
}]]
]
ColorFunction
option, the variablesx
andy
are each scaled to the interval{0, 1}
. To use the actual values, include the optionColorFunctionScaling -> False
$\endgroup$