Ticket #5956: trac_5956_figsize_units.patch
File trac_5956_figsize_units.patch, 3.5 KB (added by , 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 11 11 12 12  Jeroen Demeyer (20120419): split off this file from plot.py (:trac:`12857`) 13 13  Punarbasu Purkayastha (20120520): Add logarithmic scale (:trac:`4529`) 14  Emily Chen (20130105): Add documentation for :meth:`~sage.plot.graphics.Graphics.show` figsize parameter (:trac:`5956`) 14 15 15 16 """ 16 17 … … 1271 1272 1272 1273  ``filename``  (default: None) string 1273 1274 1274  ``dpi``  dots per inch1275 1276  ``figsize``  [width, height]1275  ``dpi``  (default: 100) dots per inch 1276 1277  ``figsize``  (default: [8.0,6.0]) [width, height] inches 1277 1278 1278 1279  ``fig_tight``  (default: True) whether to clip the drawing 1279 1280 tightly around drawn objects. If True, then the resulting … … 1444 1445 sage: c = circle((1,1), 1, color='red') 1445 1446 sage: c.show(xmin=1, xmax=3, ymin=1, ymax=3) 1446 1447 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) 1450 1454 1451 1455 You can turn off the drawing of the axes:: 1452 1456 … … 1721 1725 ... 1722 1726 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. 1723 1727 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 1725 1756 """ 1726 1757 1727 1758 # This option should not be passed on to save().