I'm currently trying to zoom in on a subset of the range of a polar plot in python, but when I do so, instead of preserving the arc length at the beginning portion of the subset, the plot compresses this portion of the plot down to a single point. I've included a generic example of the code below. I've also included the 3 plots that it creates for ease of viewing.
Update: After countless attempts, I still have not figured out how to do this. Any help would be greatly appreciated.
import random
from matplotlib import pyplot as plt
# initialize blank dataset to create blank polar plot.
r_max = 1 # max radius
r_spacing = 0.1
t_max = 60 # max angle (in degrees)
t_spacing = 1
# radius dataset at 0.1 increments
r_dat = np.linspace(0,r_max,(r_max/r_spacing)+1)
# theta dataset at 1 degree increments
t_dat = np.linspace(0,t_max,(t_max/t_spacing)+1)*np.pi/180
# blank dataset to plot an empty polar plot
blank = np.empty([len(r_dat), len(t_dat)])
blank[:] = np.nan
# desired radius subset
r_lim0 = 0.4
r_lim1 = 1.0
# plot with full radius range
fig1 = plt.figure()
ax1 = fig1.add_subplot(111, polar = True)
ax1.set_xlim(0,max(t_dat))
plt.contourf(t_dat, r_dat, blank)
plt.show()
plt.close()
# plot of the full radius range with the area of interest
# shaded in blue (the blue shaded region shows the desired
# region and desired shape of the subset plot I want)
fig2 = plt.figure()
ax2 = fig2.add_subplot(111, polar = True)
ax2.set_xlim(0,max(t_dat))
plt.contourf(t_dat, r_dat, blank)
ax2.fill_between(t_dat,r_lim0,r_lim1)
plt.show()
plt.close()
# plot of the desired subset radius range
# the shape of the region is not maintained
fig3 = plt.figure()
ax3 = fig3.add_subplot(111, polar = True)
ax3.set_xlim(0,max(t_dat))
ax3.set_ylim(r_lim0,r_lim1)
plt.contourf(t_dat, r_dat, blank)
plt.show()
plt.close()
