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[7];
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?
{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. $\endgroup$ – Kuba♦ Apr 9 '18 at 11:03