On Dec 26, 2007 4:20 PM, Peter <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I've been looking for a plot.option that ensures a 1:1 aspect ratio
> for 2D plots (e.g. something like AspectRatio->Automatic in Mma). Does
> this exist in Sage? I'm trying to set things up so that
>
> circle((0,0),2).show()
>
> shows a circle rather than an ellipse, regardless of the plot window
> dimensions. Apologies if this has already been covered somewhere.
We should just add
P.show(aspect_ratio="automatic")
etc., exactly as in Mathematica. The goal with 2d graphics in Sage
is that they at least support all options that Mathematica has.
Anyway, here is a function show11 that works exactly like show(...), but
it will always show with a 1:1 aspect ratio:
{{{
def show11(g, figsize=[5,4], **kwds):
for k in ['xmin', 'xmax', 'ymin', 'ymax']:
if kwds.has_key(k): g.__getattribute__(k)(kwds[k])
scale = (g.xmax() - g.xmin())/(g.ymax() - g.ymin())
g.show(figsize=[figsize[0], figsize[0]/scale], **kwds)
}}}
{{{
show11(plot(sin, 0, 5))
}}}
{{{
show11(circle((0,0), 2), xmin=-3, xmax=4)
}}}
This is now trac #1606:
http://trac.sagemath.org/sage_trac/ticket/1606
-- William
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---