2011-02-04 29 views
1

我在圖中有兩個子圖。如何在兩個子圖的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_on」命令,它們也不會出現在這兩個子地塊上。

我需要你的建議。

感謝你 戈皮

+2

什麼圖形庫?你試過什麼了?請顯示一些代碼。否則沒有人會知道你在說什麼。 – 2011-02-04 09:03:04

+0

謝謝Tim,我在第一個問題中添加了一段代碼。 – pottigopi 2011-02-04 09:09:33

回答

2

就叫minorticks_on()上的軸,而不是pyplot對象:

ax = plt.subplot(121) 
#.... 
ax.minorticks_on() 

ay = plt.subplot(122, ...) 
#... 
ay.minorticks_on() 
相關問題