Adaptive Sampling of 2D Graphics

First, we start with a simple plot.

gr = 
        Plot[Sin[x]^2 + Sqrt[x], {x, 0, π}, 
          DisplayFunction -> Identity];

Now, we extract out all of the points.

allpts = gr[[1, 1, 1, 1]];

Next, extract a subset of the points and Map a Line primitve around each point.  In this case, every fifth point.

pts = Take[gr[[1, 1, 1, 1]], {1, -1, 5}];
lines = Map[Line[{{#[[1]], 0}, #}] &, pts];

Finally, we do a ListPlot of the sampled points and also combine this with the Line primitives.

Show[{ListPlot[allpts, PlotJoined -> True, 
          DisplayFunction -> Identity], 
        Graphics[{Gray, Thickness[ .005], lines, Orange, PointSize[ .02], 
            Map[Point, pts]}]}, Frame -> {True, True, False, False}, 
      ImageSize -> 800, DisplayFunction -> $DisplayFunction, 
      TextStyle -> {FontFamily -> "Arial", 
          FontWeight -> "Bold"}, PlotRange -> {{0, 3}, {0, 3}}, 
      FrameLabel -> {"x", "y"}, 
      PlotLabel -> 
        DisplayForm[
          GridBox[{{StyleForm["Adaptive Sampling", FontSize -> 18, 
                  FontColor -> Gray]}, {TraditionalForm[
                  Sin[x]^2 + Sqrt[x]]}}]]]

Animation

Here, we simply insert a phase shift into the Sin term and vary the phase shift from 0 to 2 π.

\(\(anim = 
        Table[gr = 
            Plot[Sin[x - t]^2 + Sqrt[x], {x, 0, π}, 
              DisplayFunction -> Identity]; 

          allpts = gr[\([\)\(1, 1, 1, 1\)\(]\)]; 

          pts = Take[gr[\([\)\(1, 1, 1, 1\)\(]\)], {1, \(-1\), 5}]; 

          lines = Map[Line[{{#[\([\)\(1\)\(]\)], 0}, #}] &, pts]; 

          Show[{ListPlot[allpts, PlotJoined -> True, 
                DisplayFunction -> Identity], 
              Graphics[{Gray, Thickness[ .005], lines, Orange, 
                  PointSize[ .02], Map[Point, pts]}]}, 
            Frame -> {True, True, False, False}, ImageSize -> 800, 
            DisplayFunction -> $DisplayFunction, 
            TextStyle -> {FontFamily -> "Arial", 
                FontWeight -> "Bold"}, 
            PlotRange -> {{0, 3}, {0, 3}}, 
            FrameLabel -> {"x", "y"}, 
            PlotLabel -> 
              DisplayForm[
                GridBox[{{StyleForm["Adaptive Sampling", 
                        FontSize -> 18, 
                        FontColor -> Gray]}, {TraditionalForm[
                        Sin[x]^2 + Sqrt[x]]}}]]], {t, 0, 
            2\ π,  .1}];\)\)