matplotlib中刻度线的方向 [英] Direction of tick marks in matplotlib
本文介绍了matplotlib中刻度线的方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种方法可以使用matplotlib使x轴底部的刻度线指向外部,而顶部的刻度线指向内部呢?
Is there a way to make the direction of the tick marks on the bottom of the xaxis point outward, but the top ones point inward, using matplotlib?
推荐答案
是的!您可以使用set_tick_params()方法执行此操作.这是一个设置直方图以按照您描述的方式工作的示例:
Yes! You can use the set_tick_params() method to do this. Here's an example for setting up a histogram to work as you described:
hist.xaxis.set_ticks_position('both') # Adding ticks to both top and bottom
hist.xaxis.set_tick_params(direction='in', which='top') # The bottom will maintain the default of 'out'
这篇关于matplotlib中刻度线的方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文