Ticket #5956: trac_5956_figsize_units.1.patch

File trac_5956_figsize_units.1.patch, 3.6 KB (added by ppurka, 8 years ago)

apply only this

  • sage/plot/graphics.py

    # HG changeset patch
    # User Emily Chen <emchennyc@gmail.com>
    # Date 1357396763 18000
    # Node ID af0f1570723397884adb89e31dbcba3cb486a1a9
    # Parent  5149624d99e0a7de3dd1d1465092a4a842a30e16
    Trac #5956 Graphics object show() doc explains figsize dimension is inches; added doctest for max figsize and figsize values that cause segfault
    
    diff --git a/sage/plot/graphics.py b/sage/plot/graphics.py
    a b  
    1111
    1212- Jeroen Demeyer (2012-04-19): split off this file from plot.py (:trac:`12857`)
    1313- Punarbasu Purkayastha (2012-05-20): Add logarithmic scale (:trac:`4529`)
     14- Emily Chen (2013-01-05): Add documentation for :meth:`~sage.plot.graphics.Graphics.show` figsize parameter (:trac:`5956`)
    1415
    1516"""
    1617
     
    12721273
    12731274        - ``filename`` - (default: None) string
    12741275
    1275         - ``dpi`` - dots per inch
    1276 
    1277         - ``figsize`` - [width, height]
     1276        - ``dpi`` - (default: 100) dots per inch
     1277
     1278        - ``figsize`` - (default: [8.0,6.0]) [width, height] inches. The
     1279          maximum value of each of the width and the height can be 327
     1280          inches, at the default ``dpi`` of 100 dpi, which is just shy of
     1281          the maximum allowed value of 32768 dots per inch.
    12781282
    12791283        - ``fig_tight`` - (default: True) whether to clip the drawing
    12801284          tightly around drawn objects.  If True, then the resulting
     
    14551459              your own tick formatter using the option ``tick_formatter``.
    14561460
    14571461        EXAMPLES::
    1458        
     1462
    14591463            sage: c = circle((1,1), 1, color='red')
    14601464            sage: c.show(xmin=-1, xmax=3, ymin=-1, ymax=3)
    1461        
    1462         You could also just make the picture larger by changing ``figsize``::
    1463 
    1464             sage: c.show(figsize=8, xmin=-1, xmax=3, ymin=-1, ymax=3)
     1465
     1466        You can make the picture larger by changing ``figsize`` with width,
     1467        height each having a maximum value of 327 inches at default dpi::
     1468
     1469            sage: p = ellipse((0,0),4,1)
     1470            sage: p.show(figsize=[327,10],dpi=100)
     1471            sage: p.show(figsize=[328,10],dpi=80)
    14651472
    14661473        You can turn off the drawing of the axes::
    14671474
     
    17501757            ...
    17511758            ValueError: 'title_pos' must be a list or tuple of two real numbers.
    17521759
     1760        TESTS:
     1761
     1762        The figsize width and height parameters must be less than 328
     1763        inches each, corresponding to the maximum allowed dpi of 32768.::
     1764
     1765            sage: p = ellipse((0,0),4,1)
     1766            sage: p.show(figsize=[328,10],dpi=100)
     1767            Traceback (most recent call last):
     1768            ...
     1769            ValueError: width and height must each be below 32768
     1770
     1771        The following test results in a segmentation fault and should not
     1772        be doctested.::
     1773
     1774            sage: p = ellipse((0,0),4,1)
     1775            sage: p.show(figsize=[232,232],dpi=100) # not tested
     1776            Unhandled SIGSEGV: A segmentation fault occurred in Sage.
     1777            This probably occurred because a *compiled* component of Sage
     1778            has a bug in it and is not properly wrapped with sig_on(),
     1779            sig_off(). You might want to run Sage under gdb with 'sage
     1780            -gdb' to debug this.  Sage will now terminate.
     1781
     1782            sage: p.show(figsize=[327,181],dpi=100) # not tested
     1783            Unhandled SIGSEGV: A segmentation fault occurred in Sage.
     1784            This probably occurred because a *compiled* component of Sage
     1785            has a bug in it and is not properly wrapped with sig_on(),
     1786            sig_off(). You might want to run Sage under gdb with 'sage
     1787            -gdb' to debug this.  Sage will now terminate.
     1788
    17531789        """
    17541790
    17551791        # This option should not be passed on to save().