#5956: image dimensions for show() are in inches
----------------------------------------------------------------+-----------
Reporter: mvngu |
Owner: was
Type: defect |
Status: needs_review
Priority: minor |
Milestone: sage-5.9
Component: graphics |
Resolution:
Keywords: image dimensions, figsize, beginner | Work
issues:
Report Upstream: None of the above - read trac for reasoning. |
Reviewers: Karl-Dieter Crisman, Punarbasu Purkayastha
Authors: Emily Chen, Karl-Dieter Crisman | Merged
in:
Dependencies: |
Stopgaps:
----------------------------------------------------------------+-----------
Changes (by {'newvalue': u'Emily Chen, Karl-Dieter Crisman', 'oldvalue':
u'Emily Chen'}):
* author: Emily Chen => Emily Chen, Karl-Dieter Crisman
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]}}}?
>
> ----
>
> Apply only [attachment:trac_5956_figsize_units.1.patch] to devel/sage.
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 [attachment:trac_5956_figsize_units.1.patch] and
[attachment:trac_5956-reviewer.patch] to devel/sage.
--
Comment:
I think this needs some review, since I add some assertions and so forth.
I hope this clarifies things more, though, and adds doc in the main plot
page where it is probably needed.
ppurka, if you are an author too, feel free to add yourself. Positive
review to everything before my patch.
Patchbot: apply trac_5956_figsize_units.1.patch and
trac_5956-reviewer.patch to devel/sage.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5956#comment:17>
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.