介绍
这篇文章主要介绍matplotlib如何实现规模刻度,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
1.5。对数或者其他非线性坐标轴
使用plt.xscal()来改变坐标轴的刻度
import numpy as np import matplotlib.pyplot  as plt 得到matplotlib.ticker import  NullFormatter #, useful for “分对数”,规模#,Fixing random state for reproducibilitynp.random.seed (19680801) #, make up some data 拷贝,interval ] 0, 1, (=y np.random.normal (loc=0.5,=0.4,,大?1000) y =, y [(y 祝辞,0),,,(& lt; y 1)) y.sort () 时间=x np.arange (len (y)) #, plot with various axes scalesplt.figure (1) #, linearplt.subplot (221) plt.plot (x, y) plt.yscale(& # 39;线性# 39;) plt.title(& # 39;线性# 39;) plt.grid (True) #, logplt.subplot (222) plt.plot (x, y) plt.yscale(& # 39;日志# 39;) plt.title(& # 39;日志# 39;) plt.grid (True) #, symmetric logplt.subplot (223) plt.plot (x,, y 安康;y.mean ()) plt.yscale (& # 39; symlog& # 39;,, linthreshy=0.01) plt.title (& # 39; symlog& # 39;) plt.grid (True) #, logitplt.subplot (224) plt.plot (x, y) plt.yscale(& # 39;分对数# 39;) plt.title(& # 39;分对数# 39;) plt.grid (True) #, Format 从而minor tick labels of 从而y-axis into empty strings 以#,NullFormatter,,用avoid cumbering 从而axis with too many labels.plt.gca () .yaxis.set_minor_formatter (NullFormatter ()) #, Adjust 从而subplot 布局,,because 从而logit one may take more 空间#,than 通常,,due 用y-tick labels like “1,安康;10 ^ {3}“plt.subplots_adjust(最高=0.92,=0.08,,左=0.10,=0.95,,水平间距=0.25, wspace=0.35) plt.show ()
以上是“matplotlib如何实现规模刻度”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!