Say I have the following polar plot:
a=-0.49+1j*1.14
plt.polar([0,angle(x)],[0,abs(x)],linewidth=5)
And I'd like to adjust the radial limits to 0 to 2.
What is the best way to do this?
Note that I am asking specifically about the plt.polar()
method (as opposed to using polar=True
parameter in a normal plot common in similar questions).
This seems to work, unless I'm plotting from the console (Spyder, Win7):
>>> ax=plt.gca()
>>> ax.set_rlim(0,2)
To plot the graph, use the plot() function. To set the limit of the x-axis, use the xlim() function. To set the limit of the y-axis, use the ylim() function.
Matplotlib automatically arrives at the minimum and maximum values of variables to be displayed along x, y (and z axis in case of 3D plot) axes of a plot. However, it is possible to set the limits explicitly by using set_xlim() and set_ylim() functions.
To hide the axes, use plt.axis('off') To activate the labels' legend, use the legend() method. To display the figure, use the show() method.
An easier approach to solve the OP may be:
ax.set_ylim([0,2])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With