# Partition data and plot each set as a different color

data = { {2, 60}, {4.5, 62}, {6.5, 64}, {8, 65}, {9, 65}, {10,
65}, {11, 65}, {12, 67}, {13, 67}, {14, 67}, {16, 67}, {17,
67}, {18, 67}, {19, 65}, {20, 64}, {21, 70}, {22, 75}, {23,
80}, {24, 80}, {25, 82}, {26, 82}, {27, 79}, {30, 80}}

ListPlot[data, Joined -> True,
AxesLabel -> {"T(Celcius)", "Volume Collected"}]


I want to partition the data into three pieces, and the plot produced should have the points joined with a line that corresponds to the color of the point.

-
One question remains: how do you want to partition your data? – Öskå Feb 13 '14 at 19:07

ListPlot[Evaluate[
Cases[data, {a_ /; #[[1]] <= a <= #[[2]], __}] & /@
Partition[{0, 10, 20, 30}, 2, 1]], Joined -> True,
PlotStyle -> Directive[Thick],
AxesLabel -> {"T(Celcius)", "Volume Collected"}]


-

You could use ColorFunction option . The following colors plot by paritioning of x-axis. You could choose your own function:

ListPlot[data, Joined -> True,
ColorFunction ->
Function[{x, y},
Which[0 < x < 10, Red, 10 <= x < 20, Green, x >= 20, Blue]],
ColorFunctionScaling -> False, Mesh -> 10, MeshStyle -> None]


An alternative for partitioning x-values using MeshShading:

ListPlot[data, Joined -> True, Mesh -> {{10, 20}},

segment = Ceiling[Length[data]/3];