I want to get the line from plot. Then I use
Plot[Sin[x], {x, 0, 1}, MaxRecursion -> 1][[1, 1, 1, 3]]
I get somthing. But when I use
Plot[Sin[x], {x, 0, 1}, MaxRecursion -> 1][[1, 1, 1, 3, 2]]
I get
"Charting`Private`Tag$33789#1"
And I find the solution from here.
https://mathematica.stackexchange.com/a/114775
My question is : why can't that work?
[[1, 1, 1, 3]]
is really not recommended, because the details of how theGraphics[]
primitives are embedded can differ between versions of Mathematica. TryCases[Normal[Plot[Sin[x], {x, 0, 1}, MaxRecursion -> 1]], _Line, Infinity]
instead. $\endgroup$pl = Plot[Sin[x], {x, 0, 1}, MaxRecursion -> 1]; Graphics@Line@Cases[pl, Line[pts_] :> pts, Infinity]
to solve it. $\endgroup$Line[]
head only to add it back in later. Don't you think this is a little wasteful? $\endgroup$