1:1 aspect ratio in plot?

275 views
Skip to first unread message

Aaron Watters

unread,
Oct 13, 2013, 10:30:18 PM10/13/13
to sy...@googlegroups.com
Hi folks,

I have a sequence of calculations which ends up with the equation for an ellipse.
When I plot it (or half of it) using sympy.plot it looks like a circle because the plot
automatically adjusts the aspect ratio to even out the plot.  I'd like to have a 1:1
aspect ratio.  Any automatic way to get a 1:1 aspect ratio using sympy.plot? (I know there are
ways to do it using matplotlib directly...)

You can test with a formula like x**2 + 9*y**2 = 10 or something.  It always plots
looking like a circle.

Thanks in advance!  -- Aaron Watters

Aaron Meurer

unread,
Oct 14, 2013, 10:00:16 PM10/14/13
to sy...@googlegroups.com
I guess the autoscale option will do it for you. It's documentation is
buried in the docstring of the Plot object.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

Stefan Krastanov

unread,
Oct 16, 2013, 8:46:17 PM10/16/13
to sy...@googlegroups.com
See the docstring of the `Plot` class. It says that there is an
`aspect_ratio` aesthetics that can be modified as:

p = plot(...)
p.aspect_ratio = ...

The issue is that the our matplotlib backend does not use this yet. A
patch for this would be most welcomed. You can add it to the
`process_series` method of the `MatplotlibBackend` class on line 958
in plotting/plot.py. Something like `if parent.aspect_ratio != 'auto':
do stuff`
Reply all
Reply to author
Forward
0 new messages