Ticket #3853: trac_3853-fixes.2.patch

File trac_3853-fixes.2.patch, 3.3 kB (added by mhansen, 4 months ago)
  • a/sage/plot/all.py

    old new  
    1 from plot import (Graphics, line, polygon, plot, point, points
     1from plot import (Graphics, line, line2d, polygon, plot, point, points, point2d
    22                  text, circle, disk, hue, graphics_array,  
    33                  list_plot, networkx_plot, parametric_plot, 
    44                  polar_plot, contour_plot, implicit_plot, arrow, 
  • a/sage/plot/plot.py

    old new  
    23332333            sage: E = EllipticCurve('37a') 
    23342334            sage: P = E(0,0) 
    23352335            sage: def get_points(n): 
    2336             ....:     return sum([point((i*P)[0:2], pointsize=3) for i in range(-n,n) if i != 0 and (i*P)[0] < 3]) 
     2336            ...     return sum([point((i*P)[0:2], pointsize=3) for i in range(-n,n) if i != 0 and (i*P)[0] < 3]) 
    23372337            sage: sum([get_points(15*n).plot3d(z=n) for n in range(1,10)]) 
    23382338        """ 
    23392339        from sage.plot.plot3d.base import Graphics3dGroup 
     
    26652665            pass 
    26662666     
    26672667    if len(points)>0 and len(list(points[0]))!=2: 
    2668         print points 
    26692668        raise ValueError, "points must have 2 coordinates in a 2d line" 
    26702669 
    26712670     
     
    29472946    return contour_plot(f, xrange, yrange, **options) 
    29482947 
    29492948def line(points, **kwds): 
     2949    """ 
     2950    Returns either a 2-dimensional or 3-dimensional line depending 
     2951    on value of points. 
     2952 
     2953    For information regarding additional arguments, see either line2d? 
     2954    or line3d?. 
     2955 
     2956    EXAMPLES: 
     2957        sage: line([(0,0), (1,1)]) 
     2958        sage: line([(0,0,1), (1,1,1)]) 
     2959    """ 
     2960    try: 
     2961        return line2d(points, **kwds) 
     2962    except ValueError: 
     2963        from sage.plot.plot3d.shapes2 import line3d 
     2964        return line3d(points, **kwds) 
     2965 
     2966def line2d(points, **kwds): 
    29502967    r""" 
    29512968    Create the line through the given list of points. 
    29522969     
     
    32123229    return g 
    32133230 
    32143231def point(points, **kwds): 
     3232    """ 
     3233    Returns either a 2-dimensional or 3-dimensional point depending 
     3234    on value of points. 
     3235 
     3236    For information regarding additional arguments, see either point2d? 
     3237    or point3d?. 
     3238 
     3239    EXAMPLES: 
     3240        sage: point([(0,0), (1,1)]) 
     3241        sage: point([(0,0,1), (1,1,1)]) 
     3242    """ 
     3243    try: 
     3244        return point2d(points, **kwds) 
     3245    except ValueError: 
     3246        from sage.plot.plot3d.shapes2 import point3d 
     3247        return point3d(points, **kwds) 
     3248 
     3249 
     3250def point2d(points, **kwds): 
    32153251    r""" 
    32163252     
    32173253    A point of size `pointsize' defined by point = $(x,y)$. 
     
    36293665        sage: text("Sage is really neat!!",(2,12)) 
    36303666 
    36313667    The same text in larger font and colored red: 
    3632         sage: text3d("Sage is really neat!!",(2,12),fontsize=20,rgbcolor=(1,0,0)) 
     3668        sage: text("Sage is really neat!!",(2,12),fontsize=20,rgbcolor=(1,0,0)) 
    36333669 
    36343670    Some text but guaranteed to be in the lower left no matter what: 
    36353671        sage: text("Sage is really neat!!",(0,0), axis_coords=True, horizontal_alignment='left')