First time here? Check out the FAQ!

Ask Your Question
0

Sage plot inner structure

asked 11 years ago

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?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 11 years ago

tmonteil gravatar image

updated 11 years ago

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.

Preview: (hide)
link
1

answered 11 years ago

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
Preview: (hide)
link

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: 11 years ago

Seen: 271 times

Last updated: Dec 12 '13