2013-11-09 12 views
5

matplotlibプロットで上のチックと下のチックアウトをする方法はありますか? 時々私はティックを隠すデータがあり、影響を受ける側に対してのみティックアウトを設定したいと思うことがあります。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

関連する問題