我有一些代码,在一年左右的时间里使用pyplot很好用;我使用plt.plot(x,y)
制作了一个图,使用对数y轴,并将y轴刻度和刻度标签替换为以下自定义设置:
# set the axis limits
Tmin = -100 # min temperature to plot
Tmax = 40 # max temperature
Pmin = 100 # min pressure
Pmax = 1000 # max pressure
plt.axis([Tmin, Tmax, Pmax, Pmin])
# make the vertical axis a log-axis
plt.semilogy()
# make a custom list of tick values and labels
plist = range(Pmin,Pmax,100)
plabels = []
for p in plist:
plabels.append(str(p))
plt.yticks(plist,plabels)
最近将 Python 更新到当前版本的 Miniconda 后,我发现新标签仍然出现,但在科学计数法中会被 Matplotlib 的默认标签部分覆盖。因此,看起来该代码曾经用于 替换 默认刻度和标签,但现在只是添加它们。
我需要做什么才能恢复所期望的行为?为什么它会首先发生变化?