图中有两个子图。如何在两个子图的x轴和y轴上添加次刻度?
另外,如何将右子图的y标签放在y轴的右侧?
你能回答以上问题吗?
代码如下:
# Open the figure to plot the Gain variations for this frequencies
fig = plt.figure()
ax = plt.subplot(121) # To show the ascending order
plt.xlabel ('RF Input Power (dBm)', fontsize = 'smaller')
plt.ylabel ('Gain (dB)', fontsize = 'smaller')
tx = plt.title('Gain Vs Ascending RFInput for ' + str(measuredFrequencyUnderTest) + 'MHz', fontsize = 'smaller')
plt.minorticks_on()
ay = plt.subplot(122, xlim = [rfInputMax, rfInputMin], ylim = [-18.0, 30.0]) # To show the descending order
plt.xlabel ('RF Input Power (dBm)', fontsize = 'smaller')
plt.ylabel ('Gain (dB)', fontsize = 'smaller', horizontalalignment = 'left')
ty = plt.title('Gain Vs Descending RF Input for '+ str(measuredFrequencyUnderTest)+ 'MHz', fontsize = 'smaller')
此代码只在第一个子图上插入minorticks。即使我有命令”打开plt.minorticks“对于两个子地块而言,它们并不出现在两个子地块上。在
我需要你的建议。在
谢谢你 戈皮
只需在轴上调用
minorticks_on()
,而不是调用pyplot
对象:相关问题 更多 >
编程相关推荐