你遇到的问题是一个已知的错误是不容易解决。问题的核心是主要和次要壁虱的混合。设置
yticks重新定义主要刻度线,次要刻度线导致重叠。
解决此问题之前的解决方法是使用
plt.minorticks_off()(或
ax.minorticks_off()使用面向对象的API)手动禁用次要滴答声:
Tmin = -100 # min temperature to plotTmax = 40 # max temperaturePmin = 100 # min pressurePmax = 1000 # max pressureplt.axis([Tmin, Tmax, Pmax, Pmin])# make the vertical axis a log-axisplt.semilogy()plt.minorticks_off() # <-- single addition# make a custom list of tick values and labelsplist = range(Pmin,Pmax,100)plabels = []for p in plist: plabels.append(str(p))plt.yticks(plist,plabels)
至于 何时
变化发生了:它附带的默认样式的变化与matplotlib 2.0制作。



