Ticket #5956: trac_5956_figsize_units.patch

File trac_5956_figsize_units.patch, 3.5 KB (added by emchennyc, 8 years ago)
  • sage/plot/graphics.py

    # HG changeset patch
    # User Emily Chen <emchennyc@gmail.com>
    # Date 1357396763 18000
    # Node ID 977848f6426a6b32dbd4c25085a0177b11218d15
    # Parent  d06cf4b2215d37d3a87a58f65ac53234502dd471
    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
     
    12711272
    12721273        - ``filename`` - (default: None) string
    12731274
    1274         - ``dpi`` - dots per inch
    1275 
    1276         - ``figsize`` - [width, height]
     1275        - ``dpi`` - (default: 100) dots per inch
     1276
     1277        - ``figsize`` - (default: [8.0,6.0]) [width, height] inches
    12771278
    12781279        - ``fig_tight`` - (default: True) whether to clip the drawing
    12791280          tightly around drawn objects.  If True, then the resulting
     
    14441445            sage: c = circle((1,1), 1, color='red')
    14451446            sage: c.show(xmin=-1, xmax=3, ymin=-1, ymax=3)
    14461447       
    1447         You could also just make the picture larger by changing ``figsize``::
    1448 
    1449             sage: c.show(figsize=8, xmin=-1, xmax=3, ymin=-1, ymax=3)
     1448        You can make the picture larger by changing ``figsize`` with width, height each having a maximum value
     1449        of 327 inches at default dpi::
     1450
     1451            sage: e = ellipse((0,0),4,1)
     1452            sage: e.show(figsize=[327,10],dpi=100)
     1453            sage: e.show(figsize=[328,10],dpi=80)
    14501454
    14511455        You can turn off the drawing of the axes::
    14521456
     
    17211725            ...
    17221726            ValueError: Either expand the range of the dependent variable to allow two different integer powers of your `base`, or change your `base` to a smaller number.
    17231727            sage: p.show(scale='loglog', base=8) # this works.
    1724 
     1728       
     1729        TESTS::
     1730       
     1731        The figsize width and height parameters must be less than 328 inches each.::
     1732       
     1733            sage: e = ellipse((0,0),4,1)
     1734            sage: e.show(figsize=[328,10],dpi=100)
     1735            Traceback (most recent call last):
     1736            ...
     1737            ValueError: width and height must each be below 32768
     1738           
     1739        The following test results in a segmentation fault and should not be doctested.::
     1740       
     1741            sage: e = ellipse((0,0),4,1)
     1742            sage: e.show(figsize=[232,232],dpi=100) # not tested
     1743            Unhandled SIGSEGV: A segmentation fault occurred in Sage.
     1744            This probably occurred because a *compiled* component of Sage has a bug
     1745            in it and is not properly wrapped with sig_on(), sig_off(). You might
     1746            want to run Sage under gdb with 'sage -gdb' to debug this.
     1747            Sage will now terminate.
     1748           
     1749            sage: e.show(figsize=[327,181],dpi=100) # not tested
     1750            Unhandled SIGSEGV: A segmentation fault occurred in Sage.
     1751            This probably occurred because a *compiled* component of Sage has a bug
     1752            in it and is not properly wrapped with sig_on(), sig_off(). You might
     1753            want to run Sage under gdb with 'sage -gdb' to debug this.
     1754            Sage will now terminate.
     1755           
    17251756        """
    17261757
    17271758        # This option should not be passed on to save().