How to increase size of matplotlib sector plot

  Kiến thức lập trình

i have a polar plot with a very tiny angle. But image has size like it is full angle from 0-pi. When i try to decrease fig height, image width also decreases. So how to increase size of this image and place it on figure more effectively?
enter image description here

my script

def plot_density_rtheta(Rho, xmin, xmax, thetamin, thetamax):
    plt.rcParams.update({'font.size': 15})
    nx = Rho.shape[0]
    ny = Rho.shape[1]
    f1 = plt.figure(figsize=[10,10])
    rad = np.linspace(xmin, xmax, nx)
    azm = np.linspace(thetamin - np.pi/2, thetamax - np.pi/2, ny)
    r, th = np.meshgrid(rad, azm)
            
    ax = plt.subplot(projection="polar")
    ax.axis("off")

    ax.set_thetamin(thetamin*180/np.pi - 90)
    ax.set_thetamax(thetamax*180/np.pi - 90)

    im2 = plt.pcolormesh(th, r, rho, norm = colors.LogNorm(vmin = minRho, vmax = maxRho))
    cax2 = f1.add_axes([0.125,0.92,0.775,0.03])
    plt.colorbar(im2,cax=cax2,orientation='horizontal')
    plt.savefig('density_rtheta.png')
    plt.close()

LEAVE A COMMENT