Let's create some sample data

```
n = 100;
d00 = Table[{RandomReal[{-1, 1}], RandomReal[{-4, 4}], RandomReal[{-1, 1}]}, {i, 1, n}];

```

Now I want the following: create a list plot with the first element of the list as $x$ coordinate and the third element as the $y$ coordinate. 

```
d0 = Table[{d00[[i, 1]], d00[[i, 3]]}, {i, 1, Length[d00]}];

```

The color of each point is controlled by the corresponding second element. In particular, if the real number is between -2 and 2 the point should be green, while if it is lower/equal than -2 or greater/equal than 2 the point should be red.

Any suggestions?
['https://mathematica.stackexchange.com/questions/114445', 'https://mathematica.stackexchange.com', 'https://mathematica.stackexchange.com/users/5052/']
Basically a duplicate of [this question](https://mathematica.stackexchange.com/questions/105574/plotmarkers-shadows-the-settings-by-style).

You can just style each point before you pass them to `ListPlot` for things like this.

Define a color function:

```
cfun = Piecewise[{{White, # <= -2}, {Green, -2 < # < 2}, {Red, # > 2}}, Black] &

```

Then style by second element:

```
d0 = Table[Style[{d00[[i, 1]], d00[[i, 3]]}, cfun[d00[[i, 2]]]], {i, 1, Length[d00]}];

ListPlot[d0, Background -> Lighter[Gray, 0.5]]

```

[![enter image description here](https://i.stack.imgur.com/xf8ui.png)](https://i.stack.imgur.com/xf8ui.png)

**Also Specifying PlotMarkers**

Using the `PlotMarkers` option will mask the `Style` definitions, unless you specify the undocumented:

```
Method -> {"OptimizePlotMarkers" -> False}

```

Like so:

```
GraphicsRow[{
  ListPlot[d0, PlotMarkers -> {Automatic, 5}],
  ListPlot[d0, PlotMarkers -> {Automatic, 5}, Method -> {"OptimizePlotMarkers" -> False}]
}]

```

[![enter image description here](https://i.stack.imgur.com/JaHjx.png)](https://i.stack.imgur.com/JaHjx.png)
Just some variants:

```
l = RandomReal[{-4, 4}, {200, 3}];
With[{g = #[[All, {1, 3}]] & /@ GatherBy[l, #[[2]] < 2 &]},
 ListPlot[g, PlotStyle -> {Red, Green}, PlotMarkers -> {Automatic, 8}]]
ListPlot[Last@Reap[Sow[{#1, #3}, #2 < 2] & @@@ l, _, #2 &], 
 PlotStyle -> {Red, Green}, PlotMarkers -> {Automatic, 8}]
ListPlot[GroupBy[l, #[[2]] < 2 &, #[[All, {1, 3}]] &], 
 PlotStyle -> {Red, Green}, PlotMarkers -> {Automatic, 8}]

```

Outputs:

[![enter image description here](https://i.stack.imgur.com/s8rcQ.png)](https://i.stack.imgur.com/s8rcQ.png)