在我的情节中,yticks彼此太靠近了(因为我改变了yticks字体).所以我想限制/修复yticks的数量.由于我有数百个图,我想改变"globaly"(在matplotlibrc或使用字典等)
有什么想法吗?像ax.xaxis.set_major_locator(MaxNLocator(4))
全球一样的东西
顺便说一句:我找不到如何在不使用子图的情况下引用轴.任何提示?
__init__
在任何绘图之前,您可以将AutoLocator 的方法更改为您的函数:
import pylab as pl
from matplotlib import ticker
def AutoLocatorInit(self):
ticker.MaxNLocator.__init__(self, nbins=4, steps=[1, 2, 5, 10])
ticker.AutoLocator.__init__ = AutoLocatorInit
pl.plot(pl.randn(100))
pl.figure()
pl.hist(pl.randn(1000), bins=40)
pl.show()
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
739 次 |
最近记录: |