Python 如何分别放置两个子批次的轴?

Python 如何分别放置两个子批次的轴?,python,matplotlib,scale,Python,Matplotlib,Scale,我试图在Python脚本的图中有两个子图。但我无法根据输入单独设置轴。有人能帮我分别设置每个子图的x轴和y轴吗? 我包含了我已经完成的代码,但没有给出结果 fig = plt.figure() ax = plt.subplot(121) # To show the ascending order plt.xlabel ('RF Input Power (dBm)', fontsize = 'small') plt.ylabel ('Gain (dB)', fontsize = 'small')

我试图在Python脚本的图中有两个子图。但我无法根据输入单独设置轴。有人能帮我分别设置每个子图的x轴和y轴吗? 我包含了我已经完成的代码,但没有给出结果

fig = plt.figure()
ax = plt.subplot(121) # To show the ascending order
plt.xlabel ('RF Input Power (dBm)', fontsize = 'small')
plt.ylabel ('Gain (dB)', fontsize = 'small')
tx = plt.title('Gain Vs Ascending RFInputAmpl for ' + str(measuredFrequencyUnderTest) + 'MHz', fontsize = 'small')
axPlotAxis = plt.axis([rfInputMin, rfInputMax, -20.0, 30.0])

# Now, Plot all the gain stages across the RFInput
ax.plot(rfInput_Plot, lna_Pre_Plot, color = 'r', marker = '+', label = 'lna_Pre')
ax.plot(rfInput_Plot, lna_Post_Plot, color = 'm', marker = 'x', label = 'lna_Post')
ax.plot(rfInput_Plot, sampler1_Plot, color = 'k', marker = '*', label = 'Sampler1')
ax.plot(rfInput_Plot, sampler2_Plot, color = 'c', marker = 's', label = 'Sampler2')
ax.plot(rfInput_Plot, vga_Plot, color = 'b', marker = 'p', label = 'VGA')
ax.plot(rfInput_Plot, dagc1_Plot, color = 'g', marker = 'H', label = 'DAGC1')
ax.plot(rfInput_Plot, dagc2_Plot, color = 'y', marker = 'v', label = 'DAGC2')

# Put the Legend
ax.legend(loc='upper center', bbox_to_anchor = (1.3, -0.05), shadow=True,numpoints = 1, prop = legend_font_props, ncol = 3)

# Now, come to the second plot
ay = plt.subplot(122) # To show the descending order
plt.xlabel ('RF Input Power (dBm)', fontsize = 'small')
plt.ylabel ('Gain (dB)', fontsize = 'small', horizontalalignment = 'left') 
ty = plt.title('Gain Vs Descending RF Input for '+ str(measuredFrequencyUnderTest)+ 'MHz', fontsize = 'small')

# Now, fix the x axis here in descending order
plt.axis([rfInputMax, rfInputMin, y_Min_Value, y_Max_Value])
plt.minorticks_on()

我的表演有什么问题吗?请帮我更正。

您可以非常轻松地设置独立的刻度(通过ipython-pylab会话):


您可以非常轻松地设置独立的刻度(通过ipython-pylab会话):


您可能需要同时编程两个双边坐标,我们都知道,除非您的名字是Gus,否则这是不可能的。您所说的“分别为每个子图设置x轴和y轴”是什么意思?将它们设置为什么?您可能需要同时编程两个双边坐标,我们都知道,除非您的名字是Gus,否则这是不可能的。您所说的“分别设置每个子图的x轴和y轴”是什么意思?将它们设置为什么?
In [8]: ax = plt.subplot(121)
In [9]: ay = plt.subplot(122)
In [10]: ax.set_xlim((-1,2))
In [11]: ax.set_ylim((10,20))
In [12]: ay.set_xlim((-10,4))
In [13]: ay.set_ylim((3,5))