- #1
- 970
- 670
An answer posted here...
https://mathematica.stackexchange.com/questions/19859/plot-extract-data-to-a-file
... says you can extract the data from a Plot by doing this:
Having looked at the doc page on Cases, I can't figure out how this works. (And I can't imagine how someone would come up with this, using only the documentation).
I find that changing the last two arguments (-4 and 1) doesn't affect the result, as long as the third one is negative.
So what is going on in that code?
https://mathematica.stackexchange.com/questions/19859/plot-extract-data-to-a-file
... says you can extract the data from a Plot by doing this:
Code:
data = Cases[Plot[Sin@x, {x, 0, 2 Pi}], Line[data_] :> data, -4, 1][[1]];
Having looked at the doc page on Cases, I can't figure out how this works. (And I can't imagine how someone would come up with this, using only the documentation).
I find that changing the last two arguments (-4 and 1) doesn't affect the result, as long as the third one is negative.
So what is going on in that code?