如何使用 python 显式绘制 y 轴

问题描述 投票:0回答:1

我在 python 脚本中使用

pp.yscale('log')
来绘制一个以对数刻度显示 y 刻度的图形。然而,图中并没有出现y轴。有没有办法在 python 中显式显示 y 轴?

enter image description here

...
leg = pp.legend( series_labels, loc='upper right' )
pp.axis([-0.5, x_len-0.5, 0, max_y*1.1])   
configurable_xlabel = x_label + '(unit)'
pp.xlabel(configurable_xlabel)
configurable_ylabel = metrics[metric_idx] + '(unit)'
pp.ylabel(configurable_ylabel)
configurable_scaling = 2
xticklabels = []
for idx in xrange(0,x_len):
    if idx % configurable_scaling == 0:
        xticklabels.append(x_data[idx])
    else:
        xticklabels.append('');
pp.axes().set_xticks(xrange(0,x_len));
pp.axes().set_xticklabels(xticklabels[0:len(xticklabels)])
pp.yscale('log')
...
python matplotlib
1个回答
1
投票

这可能是由于对数刻度没有 0,并且可以将轴移动到另一个数字。

© www.soinside.com 2019 - 2024. All rights reserved.