#5956: image dimensions for show() are in inches
----------------------------------------------------------------+-----------
       Reporter:  mvngu                                         |         
Owner:  was                
           Type:  defect                                        |        
Status:  needs_review       
       Priority:  minor                                         |     
Milestone:  sage-5.7           
      Component:  graphics                                      |    
Resolution:                     
       Keywords:  image dimensions, figsize, beginner           |   Work 
issues:                     
Report Upstream:  None of the above - read trac for reasoning.  |     
Reviewers:  Karl-Dieter Crisman
        Authors:  Emily Chen                                    |     Merged 
in:                     
   Dependencies:                                                |      
Stopgaps:                     
----------------------------------------------------------------+-----------
Changes (by ppurka):

  * status:  needs_work => needs_review


Old description:

> As discussed at this [http://groups.google.com/group/sage-
> devel/browse_thread/thread/c411254b7bc0bb97 sage-devel thread], the
> optional argument {{{figsize}}} of the command {{{show()}}} needs to
> clearly state that the units of the image are in inches. As of Sage
> 3.4.1, the docstring for {{{show()}}} says:
> {{{
> - ``figsize``- [width, height] (same for square aspect)
> }}}
> which can be interpreted to mean that one can do something like
> {{{figsize=[w,h]}}}. But something like the following produces a
> segmentation fault:
> {{{
> [mvngu@sage ~]$ sage
> ----------------------------------------------------------------------
> | Sage Version 3.4.1, Release Date: 2009-04-21                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: q = var("q")
> sage: f(q) = (q^4 - q^2 + 1) * (q^4 + q^3 + q^2 + q + 1) * (q^4 - q^3 \
> + q^2 - q + 1) * (q^6 + q^5 + q^4 + q^3 + q^2 + q + 1) * (q^6 - q^5 + \
> q^4 - q^3 + q^2 - q + 1) * (q^(20) - q^(18) - q^(14) - q^(12) + q^(10) \
> - q^8 - q^6 - q^2 + 1)
> sage: g(q) = q^8 * (q^4 + q^2 + 1)^2 * (q^4 + 1)^5
> sage: p = complex_plot(f/g, (-2,2), (-2,2))
> sage: p.show(figsize=[256,256])
> }}}
> while the following results in a {{{ValueError}}}:
> {{{
> ----------------------------------------------------------------------
> | Sage Version 3.4.1, Release Date: 2009-04-21                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: q = var("q")
> sage: f(q) = (q^4 - q^2 + 1) * (q^4 + q^3 + q^2 + q + 1) * (q^4 - q^3 \
> + q^2 - q + 1) * (q^6 + q^5 + q^4 + q^3 + q^2 + q + 1) * (q^6 - q^5 + \
> q^4 - q^3 + q^2 - q + 1) * (q^(20) - q^(18) - q^(14) - q^(12) + q^(10) \
> - q^8 - q^6 - q^2 + 1)
> sage: g(q) = q^8 * (q^4 + q^2 + 1)^2 * (q^4 + 1)^5
> sage: p = complex_plot(f/g, (-2,2), (-2,2))
> sage: p.show(figsize=[500,500])
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call
> last)
> ...
> ValueError: width and height must each be below 32768
> }}}
> Essentially, the documentation for {{{show()}}} needs to be updated,
> especially the optional arguments, to clearly explain the units of
> measurement of the width and height of the image size. Also, it would be
> a good idea to specify how one can pass in values for those dimensions.
> For example, can one do this {{{figsize=[124,124]}}}?

New description:

 As discussed at this [http://groups.google.com/group/sage-
 devel/browse_thread/thread/c411254b7bc0bb97 sage-devel thread], the
 optional argument {{{figsize}}} of the command {{{show()}}} needs to
 clearly state that the units of the image are in inches. As of Sage 3.4.1,
 the docstring for {{{show()}}} says:
 {{{
 - ``figsize``- [width, height] (same for square aspect)
 }}}
 which can be interpreted to mean that one can do something like
 {{{figsize=[w,h]}}}. But something like the following produces a
 segmentation fault:
 {{{
 [mvngu@sage ~]$ sage
 ----------------------------------------------------------------------
 | Sage Version 3.4.1, Release Date: 2009-04-21                       |
 | Type notebook() for the GUI, and license() for information.        |
 ----------------------------------------------------------------------
 sage: q = var("q")
 sage: f(q) = (q^4 - q^2 + 1) * (q^4 + q^3 + q^2 + q + 1) * (q^4 - q^3 \
 + q^2 - q + 1) * (q^6 + q^5 + q^4 + q^3 + q^2 + q + 1) * (q^6 - q^5 + \
 q^4 - q^3 + q^2 - q + 1) * (q^(20) - q^(18) - q^(14) - q^(12) + q^(10) \
 - q^8 - q^6 - q^2 + 1)
 sage: g(q) = q^8 * (q^4 + q^2 + 1)^2 * (q^4 + 1)^5
 sage: p = complex_plot(f/g, (-2,2), (-2,2))
 sage: p.show(figsize=[256,256])
 }}}
 while the following results in a {{{ValueError}}}:
 {{{
 ----------------------------------------------------------------------
 | Sage Version 3.4.1, Release Date: 2009-04-21                       |
 | Type notebook() for the GUI, and license() for information.        |
 ----------------------------------------------------------------------
 sage: q = var("q")
 sage: f(q) = (q^4 - q^2 + 1) * (q^4 + q^3 + q^2 + q + 1) * (q^4 - q^3 \
 + q^2 - q + 1) * (q^6 + q^5 + q^4 + q^3 + q^2 + q + 1) * (q^6 - q^5 + \
 q^4 - q^3 + q^2 - q + 1) * (q^(20) - q^(18) - q^(14) - q^(12) + q^(10) \
 - q^8 - q^6 - q^2 + 1)
 sage: g(q) = q^8 * (q^4 + q^2 + 1)^2 * (q^4 + 1)^5
 sage: p = complex_plot(f/g, (-2,2), (-2,2))
 sage: p.show(figsize=[500,500])
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 ...
 ValueError: width and height must each be below 32768
 }}}
 Essentially, the documentation for {{{show()}}} needs to be updated,
 especially the optional arguments, to clearly explain the units of
 measurement of the width and height of the image size. Also, it would be a
 good idea to specify how one can pass in values for those dimensions. For
 example, can one do this {{{figsize=[124,124]}}}?

 ----

 Apply only [attachment:trac_5956_figsize_units.1.patch] to devel/sage.

--

Comment:

 Updated the patch to sage-5.7beta0 and introduced some other changes.

 The patch [attachment:only_for_review.patch] contains the changes I made
 after rebasing the patch to 5.7beta0. In particular, I have introduced the
 changes I suggested in my comments, and have fixed failing doctests due to
 the use/redefining of `e` in the earlier patch.

 The changes needs review.

 Patchbot apply trac_5956_figsize_units.1.patch

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5956#comment:12>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to