I have a lot of data points, and I have noticed that plotting using Graphics is usually much quicker than plotting with ListPlot. The problem is I am trying to color the data points based off some conditions, so for ListPlot, what I have written to do this is:
coloredData = Style[{#1, #2}, {#3, #6} /. {{0, 0} -> Gray, {0, 1} -> Black, {1, 0} -> Red}] & @@@ Partition[Flatten@data, 6]
ListPlot[coloredData]
Now, without the Style, if I were plotting my data using Graphics, I do:
dPlot = Table[Point[data[[i, All, {1, 2}]]], {i, Length@data}];
So I wanted to do the same thing with coloredData
, and wrote:
cPlot = Table[Point[Partition[coloredData, 20][[i, All, {1, 2}]]], {i, Length@Partition[coloredData, 20]}];
From the error message it seems that now the data is in the wrong format for plotting using Graphics.
So my question is this: how do I rewrite what I currently plot using ListPlot, but with Graphics? When I try looking up phrases such as "coloring points according to conditions" I'm finding results like this and this which use ListPlot, and for computational time concerns, I'd like to use Graphics instead. Any advice for how to tackle this, would be much appreciated!
Here is some of my data:
data = {{{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234, 0.5, 0}, {20, 2.15164, 0, 0.377913,0.5, 0}, {20, 6.43098, 0, 0.0116446, 0.5, 0}, {20, 7.88699, 1, 0.927266, 0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297, 1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}, {{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234, 0.5, 0}, {20, 2.15164, 0, 0.377913, 0.5, 0}, {20, 6.43098, 0, 0.0116446,0.5, 0}, {20, 7.88699, 1, 0.927266, 0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297, 1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}, {{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234, 0.5, 0}, {20, 2.15164, 0, 0.377913, 0.5, 0}, {20, 6.43098, 0, 0.0116446, 0.5, 0}, {20, 7.88699, 1, 0.927266,0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297, 1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}, {{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234, 0.5, 0}, {20, 2.15164, 0, 0.377913, 0.5, 0}, {20, 6.43098, 0, 0.0116446, 0.5, 0}, {20, 7.88699, 1, 0.927266, 0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297,1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}, {{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234,0.5, 0}, {20, 2.15164, 0, 0.377913, 0.5, 0}, {20, 6.43098, 0, 0.0116446, 0.5, 0}, {20, 7.88699, 1, 0.927266, 0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297, 1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}, {{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234, 0.5, 0}, {20, 2.15164, 0, 0.377913,0.5, 0}, {20, 6.43098, 0, 0.0116446, 0.5, 0}, {20, 7.88699, 1, 0.927266, 0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297, 1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}, {{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234, 0.5, 0}, {20, 2.15164, 0, 0.377913, 0.5, 0}, {20, 6.43098, 0, 0.0116446,0.5, 0}, {20, 7.88699, 1, 0.927266, 0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297, 1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}, {{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234, 0.5, 0}, {20, 2.15164, 0, 0.377913, 0.5, 0}, {20, 6.43098, 0, 0.0116446, 0.5, 0}, {20, 7.88699, 1, 0.927266,0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297, 1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}, {{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234, 0.5, 0}, {20, 2.15164, 0, 0.377913, 0.5, 0}, {20, 6.43098, 0, 0.0116446, 0.5, 0}, {20, 7.88699, 1, 0.927266, 0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297,1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}, {{20, 6.48815, 1, 0.876608, 0.5, 0}, {20, 6.47738, 0, 0.521964, 0.5, 0}, {20, 5.97118, 0, 0.0862234,0.5, 0}, {20, 2.15164, 0, 0.377913, 0.5, 0}, {20, 6.43098, 0, 0.0116446, 0.5, 0}, {20, 7.88699, 1, 0.927266, 0.5, 0}, {20, 3.10361, 0, 0.543757, 0.5, 0}, {20, 7.96474, 1, 0.479332, 0.5, 0}, {20, 1.86771, 0, 0.245349, 0.5, 0}, {20, 7.12694, 1, 0.759896, 0.5, 0}, {20, 1.70262, 1, 0.984993, 0.5, 0}, {20, 5.54488, 1, 0.217045, 0.5, 0}, {20, 8.75599, 1, 0.459017, 0.5, 0}, {20, 2.24446, 1, 0.884729, 0.5, 0}, {20, 1.81927, 1, 0.583854, 0.5, 0}, {20, 2.45835, 0, 0.263973, 0.5, 0}, {20, 8.80958, 1, 0.91956, 0.5, 0}, {20, 2.96297, 1, 0.423835, 0.5, 0}, {20, 8.2311, 1, 0.98729, 0.5, 0}, {20, 5.76275, 1, 0.587943, 0.5, 0}}};
newcoloredData = Style[Point[{#1, #2}], <the rest of your code in the original coloredData>]
, then pass that toGraphics
. Note the addition ofPoint
insideStyle
. $\endgroup$