【发布时间】:2017-10-01 05:22:43
【问题描述】:
我有一些代码在一年前使用 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 的科学计数法默认标签部分覆盖。所以看起来,虽然上面的代码用于替换默认刻度和标签,但现在它只是添加到它们。
我必须做什么才能重新获得所需的行为?为什么它首先发生了变化?
【问题讨论】:
-
可能是一个错误。它只发生在比例不是线性的时候。
-
如果是错误,是否有解决方法?另外,在哪里报告可能的错误?
标签: python matplotlib