ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 12 Dec 2013 06:21:39 +0100Sage plot inner structurehttps://ask.sagemath.org/question/8168/sage-plot-inner-structure/Hi, I would like to manipulate the raw data of a plot. More specifically, I'd like to get the set of points produced by implicit_plot in order to use it for another task.
Is that possible?Thu, 12 Dec 2013 03:45:49 +0100https://ask.sagemath.org/question/8168/sage-plot-inner-structure/Answer by tmonteil for <p>Hi, I would like to manipulate the raw data of a plot. More specifically, I'd like to get the set of points produced by implicit_plot in order to use it for another task.
Is that possible?</p>
https://ask.sagemath.org/question/8168/sage-plot-inner-structure/?answer=15801#post-id-15801You can try:
sage: P = implicit_plot(x^2+y^2-2, (x,-3,3), (y,-3,3))
sage: C = P._objects[0]
sage: C
ContourPlot defined by a 150 x 150 data grid
sage: C.xy_data_array
You will get a list of lists, giving evaluated values of the function on the grid row by row (or column by column, i didn't check further).
Then you get the points by looking at sign changes, or values close to zero.
Thu, 12 Dec 2013 06:21:39 +0100https://ask.sagemath.org/question/8168/sage-plot-inner-structure/?answer=15801#post-id-15801Answer by ppurka for <p>Hi, I would like to manipulate the raw data of a plot. More specifically, I'd like to get the set of points produced by implicit_plot in order to use it for another task.
Is that possible?</p>
https://ask.sagemath.org/question/8168/sage-plot-inner-structure/?answer=15800#post-id-15800Does this help?
sage: p = implicit_plot(x == y^2, (x, 0, 1), (y, 0, 1))
sage: pc = p._objects[0]
sage: pc.xy_data_array
# Big output here
Similarly for `plot`
sage: p = plot(x)
sage: pc = p._objects[0]
sage: pc.xdata, pc.ydata
Thu, 12 Dec 2013 06:19:20 +0100https://ask.sagemath.org/question/8168/sage-plot-inner-structure/?answer=15800#post-id-15800