Ticket #2100: trac_2100-3d-vector.patch

File trac_2100-3d-vector.patch, 2.7 KB (added by kcrisman, 9 years ago)

reviewer patch

  • sage/plot/plot3d/base.pyx

    # HG changeset patch
    # User Karl-Dieter Crisman <kcrisman@gmail.com>
    # Date 1295469493 18000
    # Node ID a90f5acfc025b55693ec68be37b4d3a4870e8382
    # Parent  915d4c9531ae57275a2fbad18fec6e708f13fd31
    Trac # 2100 - make sure new default aspect ratio doesn't confuse plot_vector_field3d and vector plotting
    
    diff -r 915d4c9531ae -r a90f5acfc025 sage/plot/plot3d/base.pyx
    a b  
    943943            opts['aspect_ratio'] = (1, 1, 1)
    944944        if not isinstance(opts['aspect_ratio'], (str, list, tuple)):
    945945            raise TypeError, 'aspect ratio must be a string, list, tuple, or 1'
     946        # deal with any aspect_ratio instances passed from the default options to plot
     947        if opts['aspect_ratio'] == 'auto':
     948            opts['aspect_ratio'] = 'automatic'
    946949       
    947950        if opts['frame_aspect_ratio'] == 'automatic':
    948951            if opts['aspect_ratio'] != 'automatic':
     
    10251028
    10261029            sage: sphere((0,0,0))
    10271030
    1028         EXAMPLES: We illustrate use of the aspect_ratio option::
     1031        EXAMPLES: We illustrate use of the ``aspect_ratio`` option::
    10291032
    10301033            sage: x, y = var('x,y')
    10311034            sage: p = plot3d(2*sin(x*y), (x, -pi, pi), (y, -pi, pi))
     
    10391042
    10401043            sage: p.show(aspect_ratio=[1,1,1], frame_aspect_ratio=[1,1,1/8])
    10411044
     1045        This example shows indirectly that we can accept the default
     1046        from :func:`~sage.plot.plot.plot` of ``aspect_ratio='auto'``, if desired::
     1047
     1048            sage: plot(vector([1,2,3]))
     1049
    10421050        We use the 'canvas3d' backend from inside the notebook to get a view of
    10431051        the plot rendered inline using HTML canvas::
    10441052
  • sage/plot/plot3d/plot_field3d.py

    diff -r 915d4c9531ae -r a90f5acfc025 sage/plot/plot3d/plot_field3d.py
    a b  
    5757        sage: plot_vector_field3d((x*cos(z),-y*cos(z),sin(z)), (x,0,pi), (y,0,pi), (z,0,pi),plot_points=4)
    5858        sage: plot_vector_field3d((x*cos(z),-y*cos(z),sin(z)), (x,0,pi), (y,0,pi), (z,0,pi),plot_points=[3,5,7])
    5959        sage: plot_vector_field3d((x*cos(z),-y*cos(z),sin(z)), (x,0,pi), (y,0,pi), (z,0,pi),center_arrows=True)
     60
     61    TESTS:
     62
     63    This tests that Trac # 2100 is fixed in a way compatible with this command::
     64
     65        sage: plot_vector_field3d((x*cos(z),-y*cos(z),sin(z)), (x,0,pi), (y,0,pi), (z,0,pi),center_arrows=True,aspect_ratio=(1,2,1))
    6066    """
    6167    (ff,gg,hh), ranges = setup_for_eval_on_grid(functions, [xrange, yrange, zrange], plot_points)
    6268    xpoints, ypoints, zpoints = [srange(*r, include_endpoint=True) for r in ranges]