https://blog.csdn.net/qq_42999481/article/details/82527246
主要參數及用法:
axis
參數axis的值為’x’、’y’、’both’,分別代表設置X軸、Y軸以及同時設置,默認值為’both’。
ax1.tick_params(axis=’x’,width=2,colors=’gold’)
ax2.tick_params(axis=’y’,width=2,colors=’gold’)
ax3.tick_params(axis=’both’,width=2,colors=’gold’)
which
參數which的值為 ‘major’、’minor’、’both’,分別代表設置主刻度線、副刻度線以及同時設置,默認值為’major’
ax1.tick_params(which=’major’,width=2,colors=’gold’)
ax2.tick_params(which=’minor’,width=2,colors=’gold’)
ax3.tick_params(which=’both’,width=2,colors=’gold’)
direction
參數direction的值為’in’、’out’、’inout’,分別代表刻度線顯示在繪圖區內側、外側以及同時顯示
ax1.tick_params(direction=’in’,width=2,length=4,colors=’gold’)
ax2.tick_params(direction=’out’,width=2,length=4,colors=’gold’)
ax3.tick_params(direction=’inout’,width=2,length=4,colors=’gold’)
length和width
參數length和width分別用於設置刻度線的長度和寬度
ax2.tick_params(width=4,colors=’gold’)
ax3.tick_params(length=10,colors=’gold’)
pad
參數pad用於設置刻度線與標簽間的距離
ax2.tick_params(pad=1,colors=’gold’)
ax3.tick_params(pad=10,colors=’gold’)
color、labelcolor、colors
參數color、labelcolor、colors分別用於設置刻度線的顏色、刻度線標簽的顏色以及同時設置刻度線及標簽顏色
ax1.tick_params(width=4,color=’gold’)
ax2.tick_params(width=4,labelcolor=’gold’)
ax3.tick_params(width=4,colors=’gold’)
labelsize
參數labelsize用於設置刻度線標簽的字體大小
ax1.tick_params(labelsize=’medium’)
ax2.tick_params(labelsize=’large’)
ax3.tick_params(labelsize=15)
bottom, top, left, right
參數bottom, top, left, right的值為布爾值,分別代表設置繪圖區四個邊框線上的的刻度線是否顯示
ax1.tick_params(bottom=False,top=True,width=4,colors=’gold’)
ax2.tick_params(left=False,right=True,width=4,colors=’gold’)
ax3.tick_params(top=True,right=True,width=4,colors=’gold’)
labelbottom, labeltop, labelleft, labelright
參數labelbottom, labeltop, labelleft, labelright的值為布爾值,分別代表設置繪圖區四個邊框線上的刻度線標簽是否顯示
ax1.tick_params(labelbottom=False,labeltop=True,width=4,colors=’gold’)
ax2.tick_params(labelleft=False,labelright=True,width=4,colors=’gold’)
ax3.tick_params(labeltop=True,labelright=True,width=4,colors=’gold’)
來源:http://baijiahao.baidu.com/s?id=1581255237068991290&wfr=spider&for=pc
感謝