Ask Your Question
0

Sage plot inner structure

asked 2013-12-11 20:45:49 -0500

jllb gravatar image

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?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-12-11 23:19:20 -0500

ppurka gravatar image

Does 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
edit flag offensive delete link more
1

answered 2013-12-11 23:21:39 -0500

tmonteil gravatar image

updated 2013-12-11 23:22:20 -0500

You 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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-12-11 20:45:49 -0500

Seen: 58 times

Last updated: Dec 11 '13