phystricks
Classes | Functions
phystricks.src.ImplicitCurve Namespace Reference

Classes

class  GeometricImplicitCurve
 
class  ImplicitCurveGraph
 

Functions

def get_paths_from_plot (p)
 
def get_paths_from_implicit_plot (p)
 

Function Documentation

def phystricks.src.ImplicitCurve.get_paths_from_implicit_plot (   p)
Return a list of list of points from an implicit plot.

Each list correspond to a path.

INPUT:

- ``p`` an implicit plot.

OUTPUT:

A list of lists of points. Each list corresponds to a path (see matplotlib), but the components are converted into points in the sens of phystricks (instead of matplotlib's vertices).

EXAMPLES:

The length of the list can be quite long::

    sage: from phystricks import *
    sage: from phystricks.BasicGeometricObjects import *
    sage: x,y=var('x,y')
    sage: F=implicit_plot(x**2+y**2==2,(x,-5,5),(y,-5,5))
    sage: len(get_paths_from_implicit_plot(F)[0])
    169

When you have more than one connected component, you see it ::

    sage: F=implicit_plot(x**2-y**2==2,(x,-5,5),(y,-5,5))
    sage: paths=get_paths_from_implicit_plot(F)
    sage: len(paths)
    4
    sage: type(paths[0][1])
    <class 'phystricks.BasicGeometricObjects.PointGraph'>
    sage: print paths[0][3]
    <Point(4.87405534614323,-4.6644295302013425)>
    sage: print paths[1][3]
    <Point(4.87405534614323,-4.6644295302013425)>
    sage: print paths[2][3]
    <Point(4.87405534614323,-4.6644295302013425)>
    sage: print paths[3][3]
    <Point(4.87405534614323,-4.6644295302013425)>
def phystricks.src.ImplicitCurve.get_paths_from_plot (   p)
return the paths (in the sense of matplotlib) contained in the plot object p.

The paths here are paths in the sense of matplotlib; the elements are vertices.
Not to be confused with get_paths_from_implicit_plot in which the basic elements
are points.

INPUT:
- ``p`` - a plot object

EXAMPLES:
sage: from phystricks import *
sage: from phystricks.BasicGeometricObjects import *
sage: x,y=var('x,y')
sage: F=implicit_plot(x**2+y**2==2,(x,-5,5),(y,-5,5))
sage: g=get_paths_from_plot(F)
sage: print type(g[0])
<class 'matplotlib.path.Path'>

NOTE:
The first version of the function is due to the DSM here:
http://ask.sagemath.org/question/359/get_minmax_data-on-implicit_plot