Ticket #5956: only_for_review.patch
File only_for_review.patch, 4.1 KB (added by , 8 years ago) |
---|
-
trac_5956_figsize_units.
old new 1 1 # HG changeset patch 2 2 # User Emily Chen <emchennyc@gmail.com> 3 3 # Date 1357396763 18000 4 # Node ID 1da5be6f003d21a5676dce103b69b750e7663f934 # Node ID af0f1570723397884adb89e31dbcba3cb486a1a9 5 5 # Parent 5149624d99e0a7de3dd1d1465092a4a842a30e16 6 6 Trac #5956 Graphics object show() doc explains figsize dimension is inches; added doctest for max figsize and figsize values that cause segfault 7 7 … … 16 16 17 17 """ 18 18 19 @@ -1272,9 +1273, 9@@19 @@ -1272,9 +1273,12 @@ 20 20 21 21 - ``filename`` - (default: None) string 22 22 … … 25 25 - - ``figsize`` - [width, height] 26 26 + - ``dpi`` - (default: 100) dots per inch 27 27 + 28 + - ``figsize`` - (default: [8.0,6.0]) [width, height] inches 28 + - ``figsize`` - (default: [8.0,6.0]) [width, height] inches. The 29 + maximum value of each of the width and the height can be 327 30 + inches, at the default ``dpi`` of 100 dpi, which is just shy of 31 + the maximum allowed value of 32768 dots per inch. 29 32 30 33 - ``fig_tight`` - (default: True) whether to clip the drawing 31 34 tightly around drawn objects. If True, then the resulting 32 @@ -1459,9 +1460,12 @@ 35 @@ -1455,13 +1459,16 @@ 36 your own tick formatter using the option ``tick_formatter``. 37 38 EXAMPLES:: 39 - 40 + 33 41 sage: c = circle((1,1), 1, color='red') 34 42 sage: c.show(xmin=-1, xmax=3, ymin=-1, ymax=3) 35 43 - 36 44 - You could also just make the picture larger by changing ``figsize``:: 37 45 - 38 46 - sage: c.show(figsize=8, xmin=-1, xmax=3, ymin=-1, ymax=3) 39 + You can make the picture larger by changing ``figsize`` with width, height each having a maximum value40 + of 327 inches at default dpi::41 47 + 42 + sage: e = ellipse((0,0),4,1) 43 + sage: e.show(figsize=[327,10],dpi=100) 44 + sage: e.show(figsize=[328,10],dpi=80) 48 + You can make the picture larger by changing ``figsize`` with width, 49 + height each having a maximum value of 327 inches at default dpi:: 50 + 51 + sage: p = ellipse((0,0),4,1) 52 + sage: p.show(figsize=[327,10],dpi=100) 53 + sage: p.show(figsize=[328,10],dpi=80) 45 54 46 55 You can turn off the drawing of the axes:: 47 56 48 @@ -1750,6 +175 4,35 @@57 @@ -1750,6 +1757,35 @@ 49 58 ... 50 59 ValueError: 'title_pos' must be a list or tuple of two real numbers. 51 60 52 61 + TESTS: 53 62 + 54 63 + The figsize width and height parameters must be less than 328 55 + inches each .::64 + inches each, corresponding to the maximum allowed dpi of 32768.:: 56 65 + 57 + sage: e= ellipse((0,0),4,1)58 + sage: e.show(figsize=[328,10],dpi=100)66 + sage: p = ellipse((0,0),4,1) 67 + sage: p.show(figsize=[328,10],dpi=100) 59 68 + Traceback (most recent call last): 60 69 + ... 61 70 + ValueError: width and height must each be below 32768 … … 63 72 + The following test results in a segmentation fault and should not 64 73 + be doctested.:: 65 74 + 66 + sage: e= ellipse((0,0),4,1)67 + sage: e.show(figsize=[232,232],dpi=100) # not tested75 + sage: p = ellipse((0,0),4,1) 76 + sage: p.show(figsize=[232,232],dpi=100) # not tested 68 77 + Unhandled SIGSEGV: A segmentation fault occurred in Sage. 69 78 + This probably occurred because a *compiled* component of Sage 70 79 + has a bug in it and is not properly wrapped with sig_on(), 71 80 + sig_off(). You might want to run Sage under gdb with 'sage 72 81 + -gdb' to debug this. Sage will now terminate. 73 82 + 74 + sage: e.show(figsize=[327,181],dpi=100) # not tested83 + sage: p.show(figsize=[327,181],dpi=100) # not tested 75 84 + Unhandled SIGSEGV: A segmentation fault occurred in Sage. 76 85 + This probably occurred because a *compiled* component of Sage 77 86 + has a bug in it and is not properly wrapped with sig_on(),