Ticket #4529: trac_4529-patch4.patch

File trac_4529-patch4.patch, 7.1 KB (added by kcrisman, 9 years ago)
  • sage/plot/graphics.py

    # HG changeset patch
    # User Karl-Dieter Crisman <kcrisman@gmail.com>
    # Date 1338249593 14400
    # Node ID 50f07c2d51a610112b5d2f5213348adfa29621eb
    # Parent  0addabc5061b204a19626f463cba0225b469486c
    Trac 4529 log plots - add a few more examples, doc formatting
    
    diff --git a/sage/plot/graphics.py b/sage/plot/graphics.py
    a b  
    14511451
    14521452            sage: G.show(scale='semilogy', base=2) # y axis as powers of 2
    14531453
     1454        ::
     1455
    14541456            sage: G.show(scale='semilogy', base=(3,2)) # base ignored for x-axis
    14551457
    14561458        The scale can be also given as a 2-tuple or a 3-tuple.::
    14571459
    14581460            sage: G.show(scale=('loglog', 2)) # both x and y axes in base 2
    14591461
     1462        ::
     1463
    14601464            sage: G.show(scale=('loglog', 2, 3)) # x in base 2, y in base 3
    14611465
    14621466        The base need not be an integer, though it does have to be made
     
    14711475            sage: G = list_plot(map(lambda i: 10**i, range(10)))
    14721476            sage: G.show(scale='semilogy')
    14731477
     1478        ::
     1479
    14741480            sage: G = parametric_plot((x, x**2), (x, 1, 10))
    14751481            sage: G.show(scale='loglog')
    14761482
     1483        ::
     1484
    14771485            sage: disk((5,5), 4, (0, 3*pi/2)).show(scale='loglog',base=2)
    14781486
     1487        ::
     1488
    14791489            sage: x, y = var('x, y')
    14801490            sage: G =  plot_vector_field((2^x,y^2),(x,1,10),(y,1,100))
    14811491            sage: G.show(scale='semilogx',base=2)
  • sage/plot/plot.py

    diff --git a/sage/plot/plot.py b/sage/plot/plot.py
    a b  
    6262
    6363-  :func:`graphics_array`
    6464
     65-  The following log plotting functions:
     66
     67   - :func:`plot_loglog`
     68
     69   - :func:`plot_semilogx` and :func:`plot_semilogy`
     70
     71   - :func:`list_plot_loglog`
     72
     73   - :func:`list_plot_semilogx` and :func:`list_plot_semilogy`
     74
    6575
    6676The following miscellaneous Graphics functions are included:
    6777
     
    607617      logarithmic scale. The `semilogx` scale sets the horizontal axis
    608618      to logarithmic scale. The `semilogy` scale sets the vertical axis
    609619      to logarithmic scale. The `linear` scale is the default value
    610       when :class:`~sage.graphics.Graphics` is initialized.
     620      when :class:`~sage.plot.graphics.Graphics` is initialized.
    611621
    612622    - ``xmin`` - starting x value
    613623
     
    802812
    803813        sage: plot(exp, (1, 10), scale='semilogy') # log axis on vertical
    804814
     815    ::
     816
    805817        sage: plot_semilogy(exp, (1, 10)) # same thing
    806818
     819    ::
     820
    807821        sage: plot_loglog(exp, (1, 10), scale='loglog')   # both axes are log
    808822
     823    ::
     824
    809825        sage: plot(exp, (1, 10), scale='loglog', base=2) # base of log is 2
    810826
    811827    We can also change the scale of the axes in the graphics just before
     
    14301446        sage: parametric_plot( vector([t, t+1, t^2]), (t, 0, 1))
    14311447
    14321448    Plotting in logarithmic scale is possible with 2D plots. The keyword
    1433     ``aspect_ratio`` will be ignored if the scale is not `loglog` or
    1434     `linear`.::
     1449    ``aspect_ratio`` will be ignored if the scale is not ``'loglog'`` or
     1450    ``'linear'``.::
    14351451
    14361452        sage: parametric_plot((x, x**2), (x, 1, 10), scale='loglog')
    14371453
    14381454    We can also change the scale of the axes in the graphics just before
    14391455    displaying. In this case, the ``aspect_ratio`` must be specified as
    1440     `automatic` if the ``scale`` is set to `semilogx` or `semilogy`. For
     1456    ``'automatic'`` if the ``scale`` is set to ``'semilogx'`` or ``'semilogy'``. For
    14411457    other values of the ``scale`` parameter, any ``aspect_ratio`` can be
    14421458    used, or the keyword need not be provided.::
    14431459
     
    16391655
    16401656        sage: list_plot({22: 3365, 27: 3295, 37: 3135, 42: 3020, 47: 2880, 52: 2735, 57: 2550})
    16411657
    1642     Plotting in logarithmic scale is possible for 2D plots.::
     1658    Plotting in logarithmic scale is possible for 2D list plots.
     1659    There are two different syntaxes available::
    16431660
    16441661        sage: yl = [2**k for k in range(10)]
    16451662        sage: list_plot(yl, scale='semilogy')       # log axis on vertical
    16461663
     1664    ::
     1665
     1666        sage: list_plot_semilogy(yl)       # same
     1667
     1668    ::
     1669
    16471670        sage: list_plot(yl, scale='loglog')         # both axes are log
    16481671
    1649         sage: list_plot(yl, scale='loglog', base=2) # base of log is 2
     1672    ::
     1673
     1674        sage: list_plot_loglog(yl, base=2) # base of log is 2
    16501675
    16511676    We can also change the scale of the axes in the graphics just before
    16521677    displaying::
     
    17211746
    17221747        sage: plot_loglog(exp, (1,10)) # plot in loglog scale with base 10
    17231748
     1749    ::
     1750
    17241751        sage: plot_loglog(exp, (1,10), base=2) # with base 2 on both axes
    17251752
     1753    ::
     1754
    17261755        sage: plot_loglog(exp, (1,10), base=(2,3))
    17271756
    17281757    """
     
    17471776
    17481777        sage: plot_semilogx(exp, (1,10)) # plot in semilogx scale, base 10
    17491778
     1779    ::
     1780
    17501781        sage: plot_semilogx(exp, (1,10), base=2) # with base 2
    17511782
    17521783    """
     
    17711802
    17721803        sage: plot_semilogy(exp, (1,10)) # plot in semilogy scale, base 10
    17731804
     1805    ::
     1806
    17741807        sage: plot_semilogy(exp, (1,10), base=2) # with base 2
    17751808
    17761809    """
     
    17791812@options(base=10)
    17801813def list_plot_loglog(data, plotjoined=False, **kwds):
    17811814    """
    1782     Plot the `data` in 'loglog' scale, that is, both the horizontal and the
     1815    Plot the ``data`` in 'loglog' scale, that is, both the horizontal and the
    17831816    vertical axes will be in logarithmic scale.
    17841817
    17851818    INPUTS:
     
    17961829        sage: yl = [5**k for k in range(10)]; xl = [2**k for k in range(10)]
    17971830        sage: list_plot_loglog(zip(xl, yl)) # plot in loglog scale with base 10
    17981831
     1832    ::
     1833
    17991834        sage: list_plot_loglog(zip(xl, yl), base=2) # with base 2 on both axes
    18001835
     1836    ::
     1837
    18011838        sage: list_plot_loglog(zip(xl, yl), base=(2,5))
    18021839
    18031840    """
     
    18061843@options(base=10)
    18071844def list_plot_semilogx(data, plotjoined=False, **kwds):
    18081845    """
    1809     Plot `data` in 'semilogx' scale, that is, the horizontal axis will be
     1846    Plot ``data`` in 'semilogx' scale, that is, the horizontal axis will be
    18101847    in logarithmic scale.
    18111848
    18121849    INPUTS:
     
    18141851    - ``base`` -- (default: 10) the base of the logarithm. This must be
    18151852      greater than 1.
    18161853
    1817     For all other inputs, look at the documentation of :func:`plot`.
     1854    For all other inputs, look at the documentation of :func:`list_plot`.
    18181855
    18191856    EXAMPLES::
    18201857
    18211858        sage: yl = [5**k for k in range(10)]
    18221859        sage: list_plot_semilogx(yl) # plot in semilogx scale, base 10
    18231860
     1861    ::
     1862
    18241863        sage: list_plot_semilogx(yl, base=2) # with base 2
    18251864
    18261865    """
     
    18291868@options(base=10)
    18301869def list_plot_semilogy(data, plotjoined=False, **kwds):
    18311870    """
    1832     Plot `data` in 'semilogy' scale, that is, the vertical axis will be
     1871    Plot ``data`` in 'semilogy' scale, that is, the vertical axis will be
    18331872    in logarithmic scale.
    18341873
    18351874    INPUTS:
     
    18371876    - ``base`` -- (default: 10) the base of the logarithm. This must be
    18381877      greater than 1.
    18391878
    1840     For all other inputs, look at the documentation of :func:`plot`.
     1879    For all other inputs, look at the documentation of :func:`list_plot`.
    18411880
    18421881    EXAMPLES::
    18431882
    18441883        sage: yl = [5**k for k in range(10)]
    18451884        sage: list_plot_semilogy(yl) # plot in semilogy scale, base 10
    18461885
     1886    ::
     1887
    18471888        sage: list_plot_semilogy(yl, base=5) # with base 5
    18481889
    18491890    """