简体   繁体   English

如何使用python显式绘制y轴

[英]how to explicitly plot y axis with python

I used pp.yscale('log') in my python script to plot a figure with y ticks shown in log scale. 我在python脚本中使用pp.yscale('log')绘制了一个带有y刻度的对数,以对数刻度显示。 However, in the figure, the y axis does not appear. 但是,图中未显示y轴。 Is there any way to explicitly show y axis in python? 有什么方法可以在python中显式显示y轴吗?

在此处输入图片说明

...
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')
...

I suggested on a duplicate of this question that it might be due to logarithmic scales having no 0 and suggested further that one might be able to move the axis to another number. 我在这个问题重复题中提出 ,这可能是由于对数标度不为0所致,并进一步建议人们可以将轴移至另一个数字。 I have no way to check this but Richard stated that this is a solution. 我没有办法检查一下,但是Richard表示这是一个解决方案。 I hope it is :-} 我希望是:-}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM