I'm trying to plot the graphs of some mathematics equations using Sympy
.
The graphs representing the equations look fine but when I checked the indexes on both the X-axis
& the Y-axis
, they are not equal. In other words, the Y-axis
might represent twice the length of the X-Axis
. You can check the picture below for a better visual understanding.
So my question is: How can we adjust the coordinate plane so that the X-axis
and Y-axis
are equal in length?
Thank you
Code :
formula = x**2 - 5*x 9
plot( formula )
CodePudding user response:
There is the aspect_ratio
keyword argument that allows you to achieve what you want by specifying aspect_ratio=(1, 1)
(same aspect ratio on both axis). You might also want to play with xlim
and ylim
to center the view:
formula = x**2 - 5*x 9
plot( formula, aspect_ratio=(1, 1), xlim=(-2.5, 7.5), ylim=(0, 10) )