default aspect ratio

22 views
Skip to first unread message

Jason Grout

unread,
Dec 22, 2011, 9:29:00 AM12/22/11
to sage-...@googlegroups.com
Ticket 12213 changes the default aspect ratio for a blank graphics
object to 'automatic' instead of 1.0. This means that many objects who
don't have explicitly set default aspect ratios will now default to
'automatic'. This means they will fill the figure size, which usually
is not square, so the end result is that the aspect ratio will not be
equal (i.e., circles will be squished, etc.).

I propose that the following objects default to an aspect ratio of 1.0.
The idea is that when someone plots these objects, they typically
want angles to appear as they really are:

* circle
* arc
* disk
* ellipse
* polygon

Are there any objections to these objects having a default aspect ratio
of 1.0?

Having an aspect ratio of 1.0 means that if you combine it with a plot
with aspect ratio 'automatic', the result will have aspect ratio 1.0
(since numbers override 'automatic'). For example:

sage: P = plot(x^2,(x,0,1))
sage: P.aspect_ratio()
'automatic'
sage: Q = P + circle((0,0),1)
sage: Q.aspect_ratio()
1.0

I've posted a patch for these aspect ratio changes at
http://trac.sagemath.org/sage_trac/ticket/12222, which needs review.

Thanks,

Jason

Volker Braun

unread,
Dec 22, 2011, 9:49:42 AM12/22/11
to sage-...@googlegroups.com
I would remove ellipse and polygon from the list. Apart from that it sounds great.

Jason Grout

unread,
Dec 22, 2011, 10:56:30 AM12/22/11
to sage-...@googlegroups.com
On 12/22/11 8:49 AM, Volker Braun wrote:
> I would remove ellipse and polygon from the list. Apart from that it
> sounds great.

An arc is just part of a filled ellipse. So why would you remove
ellipse and not arc?

Thanks,

Jason

Volker Braun

unread,
Dec 22, 2011, 11:35:03 AM12/22/11
to sage-...@googlegroups.com
On Thursday, December 22, 2011 3:56:30 PM UTC, jason wrote:

An arc is just part of a filled ellipse.  So why would you remove
ellipse and not arc?

Actually I didn't know that. With default arguments an arc is a circle segment, but you can also optionally specify a second radius. So its round by default, but not always. I don't have any strong opinion about which default aspect ratio to use in this case ;-)

Jason Grout

unread,
Dec 22, 2011, 12:27:18 PM12/22/11
to sage-...@googlegroups.com
On 12/22/11 10:35 AM, Volker Braun wrote:
> Actually I didn't know that. With default arguments an arc is a circle
> segment, but you can also optionally specify a second radius. So its
> round by default, but not always. I don't have any strong opinion about
> which default aspect ratio to use in this case ;-)

Ah; I learned something too. I didn't realize that the second radius
was optional.

But you say polygons should be 'automatic' aspect ratio? I guess that
makes sense---you are just connecting points, so it's practically like
line, which has 'automatic' aspect ratio.

Anyone else that actually uses polygons: what do you think the default
aspect ratio should be?

Thanks,

Jason


William Stein

unread,
Dec 22, 2011, 12:35:16 PM12/22/11
to sage-...@googlegroups.com

I think it should be whatever it is in Mathematica. (Same answer
for the other special cases.)

-- William

>
> Thanks,
>
> Jason
>
>
>
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Jason Grout

unread,
Dec 22, 2011, 12:45:11 PM12/22/11
to sage-...@googlegroups.com
On 12/22/11 11:35 AM, William Stein wrote:
> On Thu, Dec 22, 2011 at 9:27 AM, Jason Grout
> <jason...@creativetrax.com> wrote:
>> On 12/22/11 10:35 AM, Volker Braun wrote:
>>>
>>> Actually I didn't know that. With default arguments an arc is a circle
>>> segment, but you can also optionally specify a second radius. So its
>>> round by default, but not always. I don't have any strong opinion about
>>> which default aspect ratio to use in this case ;-)
>>
>>
>> Ah; I learned something too. I didn't realize that the second radius was
>> optional.
>>
>> But you say polygons should be 'automatic' aspect ratio? I guess that makes
>> sense---you are just connecting points, so it's practically like line, which
>> has 'automatic' aspect ratio.
>>
>> Anyone else that actually uses polygons: what do you think the default
>> aspect ratio should be?
>
> I think it should be whatever it is in Mathematica. (Same answer
> for the other special cases.)

They have a different notion of "aspect ratio" (there, aspect ratio is
the picture dimension ratio, while for us, it is the pixel dimension
ratio), so it is comparing apples and oranges, in a sense. However,
their default Polygon, Circle (and ellipse), and Disk look like
polygons, circles, and disks, so I guess that's a vote for aspect ratio
1 for each of them.

Jason

William Stein

unread,
Dec 22, 2011, 1:10:59 PM12/22/11
to sage-...@googlegroups.com
On Thu, Dec 22, 2011 at 9:45 AM, Jason Grout

<jason...@creativetrax.com> wrote:
> On 12/22/11 11:35 AM, William Stein wrote:
>>
>> On Thu, Dec 22, 2011 at 9:27 AM, Jason Grout
>> <jason...@creativetrax.com>  wrote:
>>>
>>> On 12/22/11 10:35 AM, Volker Braun wrote:
>>>>
>>>>
>>>> Actually I didn't know that. With default arguments an arc is a circle
>>>> segment, but you can also optionally specify a second radius. So its
>>>> round by default, but not always. I don't have any strong opinion about
>>>> which default aspect ratio to use in this case ;-)
>>>
>>>
>>>
>>> Ah; I learned something too.  I didn't realize that the second radius was
>>> optional.
>>>
>>> But you say polygons should be 'automatic' aspect ratio?  I guess that
>>> makes
>>> sense---you are just connecting points, so it's practically like line,
>>> which
>>> has 'automatic' aspect ratio.
>>>
>>> Anyone else that actually uses polygons: what do you think the default
>>> aspect ratio should be?
>>
>>
>> I think it should be whatever it is in Mathematica.    (Same answer
>> for the other special cases.)
>
>
> They have a different notion of "aspect ratio" (there, aspect ratio is the
> picture dimension ratio, while for us, it is the pixel dimension ratio), so

Huh? Also, is "us" really matplotlib?

> it is comparing apples and oranges, in a sense.  However, their default
> Polygon, Circle (and ellipse), and Disk look like polygons, circles, and
> disks, so I guess that's a vote for aspect ratio 1 for each of them.

That sounds good to me.

Volker Braun

unread,
Dec 22, 2011, 1:33:30 PM12/22/11
to sage-...@googlegroups.com
On Thursday, December 22, 2011 5:45:11 PM UTC, jason wrote:

 However,
their default Polygon, Circle (and ellipse), and Disk look like
polygons, circles, and disks, so I guess that's a vote for aspect ratio
1 for each of them.

A polygon will always look like a polygon, no matter the aspect ratio. Sage doesn't have a plot command for *regular* polygons. 

As another data point, Maple seems to always plot with the analog of aspect_ratio='automatic'. Also, there are no graphics primitives for circles and stuff, at least none that I can find.

Jason Grout

unread,
Dec 22, 2011, 3:31:10 PM12/22/11
to sage-...@googlegroups.com

Yes; we adopted the matplotlib terminology for aspect ratio.
Mathematica's notion of aspect ratio is obtained for us, I think, by
using figsize with fig_tight=False and aspect_ratio='automatic'.

I tried to explain it on #2100. There, what I call "figure aspect
ratio" is what Mathematica is talking about with their AspectRatio option.

>
>> it is comparing apples and oranges, in a sense. However, their default
>> Polygon, Circle (and ellipse), and Disk look like polygons, circles, and
>> disks, so I guess that's a vote for aspect ratio 1 for each of them.
>
> That sounds good to me.

Great. The patch up at #12222 implements this, so I guess it's ready
for review if there are no more comments (novoselt has some comments up
on #12222 that basically start the discussion for a more intelligent
decision about aspect ratio, but that is more ambitious that #12222,
whose purpose is fixing some of the things that broke from #12213, so
probably should be carried to another ticket).

Thanks,

Jason

Reply all
Reply to author
Forward
0 new messages