# Color points in ListPointPlot3D in Manipulate

I have a Manipulate that allow users to choose which costs to disabled and they can slide the remaining sliders. I want the points that have (x,y,z) cost less than the value of active slider to be in red color and the remaining points in blue color.

For example, if "without" cost 1 is chosen, all the points that are less than $\epsilon_2$ and $\epsilon_3$ needs to be in red color following the slider. Any suggestions?

Here is the code that I've done.

p = Cuboid[{-100, -100, -100}, {100, 100, 100}];
pt = RandomPoint[p, 200];

Manipulate[
f = ContourPlot3D[x == Subscript[\[Epsilon], 1], {x, -150, 150}, {y, -150, 150},
{z, -150, 150}, Mesh -> None, BoundaryStyle -> None, ContourStyle -> Opacity[0.7]];
g = ContourPlot3D[y == Subscript[\[Epsilon], 2], {x, -150, 150}, {y, -150, 150},
{z, -150, 150}, Mesh -> None, BoundaryStyle -> None, ContourStyle -> Opacity[0.7]];
h = ContourPlot3D[z == Subscript[\[Epsilon], 3], {x, -150, 150}, {y, -150, 150},
{z, -150, 150}, Mesh -> None, BoundaryStyle -> None, ContourStyle -> Opacity[0.7]];

Show[
If[without == "cost 1", Show[g, h],
If[without == "cost 2", Show[f, h],
If[without == "cost 3", Show[f, g], Graphics3D[]]]],
ListPointPlot3D[pt, PlotStyle -> Directive[Red, PointSize[Medium]]],
AxesLabel -> {Subscript[c, 1], Subscript[c, 2], Subscript[c, 3]}],

{Subscript[\[Epsilon], 1], -100, 100, Appearance -> "Labeled", Enabled ->(without =!= "cost 1")},
{Subscript[\[Epsilon], 2], -100, 100, Appearance -> "Labeled", Enabled -> (without =!= "cost 2")},
{Subscript[\[Epsilon], 3], -100, 100, Appearance -> "Labeled", Enabled -> (without =!= "cost 3")},
{without, {"cost 1", "cost 2", "cost 3"}, ControlType -> PopupMenu},
Button["Reset", {Subscript[\[Epsilon], 1] = -100,
Subscript[\[Epsilon], 2] = -100, Subscript[\[Epsilon], 3] = -100}, ImageSize -> Large],
ControlPlacement -> Left]

• By the words: "less than the value of active slider" do you mean that the points turn red while you move the slider, but return to, say, blue, after you stop moving it? Or, otherwise, they stay red forever, after they once turned red? Commented Oct 15, 2018 at 12:05
• i want the points react following user's action on the plane. When the point's value is less than the slider's value, it turns red; otherwise remain blue. Commented Oct 18, 2018 at 16:02
• OK, then the word "active" was misleading. In this case, the answer given by kglr solves the problem. Commented Oct 19, 2018 at 7:27

Manipulate[mask = Boole[without =!= #] & /@ {"cost 1", "cost 2", "cost 3"};
{b1, b2, b3} = {Subscript[ϵ, 1], Subscript[ϵ, 2], Subscript[ϵ, 3]} mask + (1 - mask) 150;
Show[ContourPlot3D[Evaluate@{x == Subscript[ϵ, 1],  y == Subscript[ϵ, 2],
z == Subscript[ϵ, 3]}, {x, -150, 150}, {y, -150, 150}, {z, -150, 150},
Mesh -> None, BoundaryStyle -> None,  ContourStyle -> (Opacity[0.7 #] & /@ mask)],
ListPointPlot3D[pt, ColorFunctionScaling -> False,
ColorFunction -> (If[And @@ Thread[{#, #2, #3} < {b1, b2, b3}],  Red, Blue] &),
PlotStyle -> PointSize[Medium]], AxesLabel -> (Subscript[c, #] & /@ {1, 2, 3})],
{mask, None}, {b1, None}, {b2, None}, {b3, None},
{Subscript[ϵ, 1], -100, 100, Appearance -> "Labeled", Enabled -> (without =!= "cost 1")},
{Subscript[ϵ, 2], -100, 100, Appearance -> "Labeled", Enabled -> (without =!= "cost 2")},
{Subscript[ϵ, 3], -100, 100, Appearance -> "Labeled", Enabled -> (without =!= "cost 3")},
{without, {"cost 1", "cost 2", "cost 3"}, ControlType -> PopupMenu},
Button["Reset", {Subscript[ϵ, 1] = -100, Subscript[ϵ, 2] = -100, Subscript[ϵ, 3] = -100},
ImageSize -> Large], ControlPlacement -> Left]