# Individual synchronized point/line coloring

This is a extension to this question and the answer from Jason B.

Consider a list of plots

    (Evaluate[Symbol["plt" <> IntegerString[#]]] =
Plot[(x - 4*# + 16)^2, {x, -20, 20}]) & /@ Range;
Show[{plt1, plt2, plt3, plt4, plt5, plt6, plt7}] Say, we want to change the color of the plots, which are previously defined. Here is the solution from Jason.

Show[MapIndexed[#1 /. {{a__, Line[b__]} :> {a,
ColorData[97, First@#2], Line[b]}} &, {plt1, plt2, plt3, plt4,plt5, plt6, plt7}], Graphics[{PointSize[0.01], Point[Table[{-16 + 4*ii, 0}, {ii, 7}]]}] ] Now, suppose we need to add some points to the plot (see Fig. above) so that every point corresponds to a plot. How do I make the colors of the points to match the colors of the corresponding plots?

• You can put it in: {a, ColorData[97, First@#2], Line[b]}}. #2 is an index of a plot so you can use it to extract expected point from your list. – Kuba Apr 9 '18 at 11:03

Show[MapIndexed[#1 /. {{a__, Line[b__]} :> {a,
ColorData[97, First@#2], Line[b]}} &, {plt1, plt2, plt3, plt4, plt5, plt6, plt7}],
Graphics[{PointSize[0.02], Table[{ColorData[97, ii], Point@{-16 + 4*ii, 0}}, {ii, 7}]}]]


or

Show[MapIndexed[#1 /. {{a__, Line[b__]} :> {a,
ColorData[97, First@#2], Line[b], PointSize[.02], Point@{-16 + 4* First@#2 , 0} }} &,
{plt1, plt2, plt3, plt4, plt5, plt6, plt7}] ] 