The output of the Mathematica command
ListPointPlot3D[
Join @@ Table[{x, y, 0}, {x, -6, 6, 1}, {y, -6, 6, 1}],
PlotStyle -> PointSize[0.02]]
is the following image.
I want to color the points (0,0) and (1,2) with the color red. How do I modify the above command for this?
A very simple and straightforward way would be:
Of course, I left it without explicitly specifying colors because the next default color is red. However, if you want to specify your own, you can modify it a little more as:
One could use the
ColorFunction
option toListPointPlot3D
:It is important to include the
ColorFunctionScaling -> False
option because otherwise the x, y and z co-ordinates passed to the colour function will be normalized into the range 0 to 1.ColorFunction
also allows us to define point colouring using arbitrary computations, for example:yoda shows a fine method. Sometimes however, it is easier to work directly with graphics primitives. Here is an example of that, though in this case I would choose yoda's method.