Ask Your Question

Sage plot inner structure

asked 2013-12-12 03:45:49 +0200

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

answered 2013-12-12 06:21:39 +0200

tmonteil gravatar image

updated 2013-12-12 06:22:20 +0200

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

answered 2013-12-12 06:19:20 +0200

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

Your Answer

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

Add Answer

Question Tools


Asked: 2013-12-12 03:45:49 +0200

Seen: 193 times

Last updated: Dec 12 '13