Ask Your Question

Revision history [back]

get_minmax_data on implicit_plot

This is a sequel of my question about plotting level set.

In the following, G is a circle :

sage: f(x,y)=x**2+y**2  
sage: G=implicit_plot(f==1,(x,-2,2),(y,-3,3))
sage: G.get_minmax_data()
{'xmin': -2.0, 'ymin': -3.0, 'ymax': 3.0, 'xmax': 2.0}

The "correct" get_minmax_data sould be

{'xmin': -1.0, 'ymin': -1.0, 'ymax': 1.0, 'xmax': 1.0}

As far as I understood the code (and the thread "Retrieving xy data from implicit plots" on Sage-support), the following is the relevant part :

xy_data_arrays = numpy.asarray([[[func(x, y) for x in xsrange(*ranges[0],include_endpoint=True)]
                                 for y in xsrange(*ranges[1], include_endpoint=True)]
                                for func in g],dtype=float)

in ../plot/contour_plot.py

My questions are :

  1. can I retrieve that xy_data_array ?

  2. If I analyse xy_data_array, I suppose that extracting the point with lowest x-component such that the value is positive will provide me the "correct" xmin of the plot. I'm wrong ?

click to hide/show revision 2
retagged

get_minmax_data on implicit_plot

This is a sequel of my question about plotting level set.

In the following, G is a circle :

sage: f(x,y)=x**2+y**2  
sage: G=implicit_plot(f==1,(x,-2,2),(y,-3,3))
sage: G.get_minmax_data()
{'xmin': -2.0, 'ymin': -3.0, 'ymax': 3.0, 'xmax': 2.0}

The "correct" get_minmax_data sould be

{'xmin': -1.0, 'ymin': -1.0, 'ymax': 1.0, 'xmax': 1.0}

As far as I understood the code (and the thread "Retrieving xy data from implicit plots" on Sage-support), the following is the relevant part :

xy_data_arrays = numpy.asarray([[[func(x, y) for x in xsrange(*ranges[0],include_endpoint=True)]
                                 for y in xsrange(*ranges[1], include_endpoint=True)]
                                for func in g],dtype=float)

in ../plot/contour_plot.py

My questions are :

  1. can I retrieve that xy_data_array ?

  2. If I analyse xy_data_array, I suppose that extracting the point with lowest x-component such that the value is positive will provide me the "correct" xmin of the plot. I'm wrong ?