Given a list A and a ListPlot of A how can the plotting points be color coded by the values in list B?
A={{1,1},{2,2},{3,3},{4,4},{5,5}}; B={Red,Red,Blue,Blue,Blue};
This has to be an easy task than I am making difficult. Help please.
You could wrap the point data values in Style, something along the lines of:
ListPlot[{Style[{1,1},Red], Style[{2,2},Blue],etc..}]
This is described in the documentation for ListPlot if you drill down into Scope and then Wrappers.
Tried the wrappers. Worked great for small datasets. For large (500,000) datasets it was too slow. Had to go ahead and separate the data into multiple lists. The language R was the model.
This will do the trick.
A = RandomReal[{0, 10}, {10000, 2}]; B = RandomChoice[{Red, Green, Blue}, 10000]; AB = GatherBy[Thread[{A, B}], Last]; col = AB[[All, 1, 2]]; points = AB[[All, All, 1]]; ListPlot[points, PlotStyle -> col]