2013-11-09 5 views
5

क्या मैटलप्लिब प्लॉट्स में शीर्ष टिक और नीचे टिक टिकने का कोई तरीका है? कभी-कभी मेरे पास डेटा छिपाने की चीजें हैं और मैं केवल प्रभावित पक्ष के लिए टिक सेट करना चाहता हूं।matplotlib शीर्ष तल अलग-अलग

निम्न कोड दोनों ऊपर और नीचे या दोनों दाएं और बाएं को प्रभावित करेगा।

import matplotlib.pyplot as plt 
fig = plt.figure() 
ax = fig.add_subplot(111) 
ax.plot([0, 1, 3], 'o') 
ax.tick_params(direction = 'out') 
plt.show() 

उत्तर

3

आप जुड़वां कुल्हाड़ियों, तो आप अलग से प्रत्येक पक्ष के लिए गुण सेट कर सकते हैं कर सकते हैं:

import matplotlib.pyplot as plt 
fig = plt.figure() 
ax = fig.add_subplot(111) 
ax.plot([0, 1, 3], 'o') 

axR = ax.twinx() 
axT = ax.twiny() 

ax.tick_params(direction = 'out') 
axR.tick_params(direction = 'in') 

ax.tick_params(direction = 'out') 
axT.tick_params(direction = 'in') 

plt.show() 

enter image description here