# Plotting multiple series with ListLinePlot

I would like to plot 2 series of data on a ListLinePlot. One is made up of a single line, one is split. Each one would ideally be separately coloured lines and noted in the legend.

I think I've managed to transfer most of my code for a single series into a plot with two, and I can get the points to appear and the calculations to complete and the epilog appear, but not the actual line.

Can anyone help me with getting the line / legend to appear? I believe the problem is likely something to do with how the brackets are laid out near where it says LineLinePlot[{set[1]}

  dataSet = {{63, 1.26}, {92, 1.74}, {156, 1.88}, {250, 2.33}, {317,
2.69}, {351, 2.85}, {357, 3.42}, {391, 3.43}, {422, 3.44}};
dataSet2 = {{50, 0.55}, {167, 1.6}, {169, 2.47}, {182, 3.2}, {227,
3.32}, {232, 3.39}, {262, 3.91}, {281, 1.26}, {310, 1.74}, {374,
1.88}, {468, 2.33}, {535, 2.69}, {575, 3.42}, {609, 3.43}, {640,
3.44}};

set[1] = Cases[dataSet, {x_, y_} /; x < 423];
set[2] = Cases[dataSet2, {x_, y_} /; x < 263];
set[3] = Cases[dataSet2, {x_, y_} /; x > 264];

avgCurrent =
Integrate[
Interpolation[dataSet, InterpolationOrder -> 1][x], {x,
dataSet[[1, 1]], dataSet[[-1, 1]]}]/(Subtract @@
dataSet[[{-1, 1}, 1]]) // N // SetPrecision[#, 3] &
maxCurrent = MaximalBy[dataSet, Last][[1, 2]];
noPoints = Length[dataSet];

avgCurrent2 =
Integrate[
Interpolation[dataSet2, InterpolationOrder -> 1][x], {x,
dataSet2[[1, 1]], dataSet2[[-1, 1]]}]/(Subtract @@
dataSet2[[{-1, 1}, 1]]) // N // SetPrecision[#, 3] &
maxCurrent2 = MaximalBy[dataSet2, Last][[1, 2]];
noPoints2 = Length[dataSet2];

ListLinePlot[{set[1]}, PlotRange -> {{0, 700}, {0, 6}},
PlotStyle -> {Directive[RGBColor[0., 0.75, 0.85],
AbsoluteThickness[2.5]], {set[2], set[3],
PlotRange -> {{0, 700, {0, 5},
PlotStyle -> {Directive[RGBColor[0.4, 0.5, 0.6],
AbsoluteThickness[2.5]]}}}}}, PlotTheme -> "Detailed",
Epilog -> {{Red, AbsolutePointSize[4], Point[dataSet]}, {Dashed,
Line[{{262, 3.91}, {281, 1.26}}]}, {Purple,
AbsolutePointSize[4], Point[dataSet2]},
Inset[Framed[
Grid[{{Style["Cathode 284 - Drilled",
Bold]}, {"Average Current: ", avgCurrent,
" \[Mu]A"}, {"Maximum Current: ", maxCurrent,
"minutes"}, {"Number of Data Points: ", noPoints}}],
Background -> White, RoundingRadius -> 5], Scaled[{.40, .85}]],
Inset[Framed[
Grid[{{Style["Cathode 285 - Undrilled", Bold,
TextAlignment -> Center]}, {"Average Current: ", avgCurrent2,
" \[Mu]A"}, {"Maximum Current: ", maxCurrent2,
"minutes"}, {"Number of Data Points: ", noPoints2}}],
Background -> White, RoundingRadius -> 5], Scaled[{.80, .85}]]},
PlotLabel ->
"Current Yield: Drilled Iron Cathode vs. Undrilled Iron Cathode",
PlotLegends ->
Placed[LineLegend[{"Iron (Cathode 284 - Drilled)",
"Iron (Cathode 285 - Undrilled)"},
LegendFunction -> "Panel"], {0.80, 0.28}],
LabelStyle -> {Black, Bold}, Frame -> {{True, False}, {True, False}},
FrameLabel -> {"Cathode Runtime (minutes)", "Current (\[Mu]A)"},
ImageSize -> {550, 550}, InterpolationOrder -> 1]


The target is something like this (except with 2 lines):

Currently, it outputs:

• Thanks for a clear description of your on-topic goal (✅) and the well formatted, easy to copy&paste, in Raw InputForm Wolfram Language code example (✅). You question would be easier to answer and more useful for future readers if it was a minimal working code example instead of that long piece of code with so many details irrelevant to the question. (❌) Commented Nov 3, 2022 at 16:52
• Perhaps you want ListLinePlot[{set[1], set[2], set[3]},...]? Commented Nov 3, 2022 at 20:14

How's this:

ListLinePlot[{set[1], set[2], set[3]},
PlotRange -> {{0, 700}, {0, 6}},
PlotStyle -> {Directive[RGBColor[0.4, 0.5, 0.6],
AbsoluteThickness[2.5]],
Directive[RGBColor[0.8, 0.5, 0.6], AbsoluteThickness[2.5]],
Directive[RGBColor[0.8, 0.5, 0.6], AbsoluteThickness[2.5]]},
PlotTheme -> "Detailed",
Epilog -> {
{Red, AbsolutePointSize[4], Point[dataSet]}, {Dashed,
Line[{{262, 3.91}, {281, 1.26}}]},
{Purple, AbsolutePointSize[4], Point[dataSet2]},
Inset[Framed[
Grid[{{Style["Cathode 284 - Drilled",
Bold]}, {"Average Current: ", avgCurrent,
" \[Mu]A"}, {"Maximum Current: ", maxCurrent,
"minutes"}, {"Number of Data Points: ", noPoints}}],
Background -> White, RoundingRadius -> 5], Scaled[{.40, .85}]],
Inset[Framed[
Grid[{{Style["Cathode 285 - Undrilled", Bold,
TextAlignment -> Center]}, {"Average Current: ", avgCurrent2,
" \[Mu]A"}, {"Maximum Current: ", maxCurrent2,
"minutes"}, {"Number of Data Points: ", noPoints2}}],
Background -> White, RoundingRadius -> 5], Scaled[{.80, .85}]]},
PlotLabel ->
"Current Yield: Drilled Iron Cathode vs. Undrilled Iron Cathode",
PlotLegends ->
Placed[LineLegend[{"Iron (Cathode 284 - Drilled)",
"Iron (Cathode 285 - Undrilled)"},
LegendFunction -> "Panel"], {0.80, 0.28}],
LabelStyle -> {Black, Bold}, Frame -> {{True, False}, {True, False}},
FrameLabel -> {"Cathode Runtime (minutes)", "Current (\[Mu]A)"},
ImageSize -> {550, 550}, InterpolationOrder -> 1]


• Line colors are incorrect. See my comment in the question. Commented Nov 3, 2022 at 21:41
• Oh I see, just a minute... Commented Nov 3, 2022 at 22:03
• There you go. Second and third plot style directives control the color of the second and third plot lines (undrilled). Commented Nov 3, 2022 at 22:10
• This is perfect thank you. I wasn't too far off - still would've taken me days to spot what I did wrong Commented Nov 4, 2022 at 11:24