Y轴值未在matplotlib.pyplot图中显示

时间:2017-10-26 13:47:52

标签: python-3.x matplotlib plot

我的情节没有显示我的y值在轴上的数量级的任何指示。如何强制python在y轴上指示一些值?

import numpy as np
import matplotlib.pyplot as plt

BERfinal = [0.4967843137254903, 0.49215686274509757, 0.4938823529411763, 
0.49170588235294116, 0.48852941176470605, 0.48203921568627417, 
0.4797058823529405, 0.47454901960784257, 0.4795686274509802, 
0.474901960784313, 0.4732549019607838, 0.4703137254901953, 
0.4705490196078425]

x = np.linspace(-4,8,len(BERfinal))
plt.semilogy(x,BERfinal)
plt.title("BER vs SNR")
plt.ylabel("Bit Error Rate(BER)")
plt.xlabel("Signal-to-Noise Ratio(SNR)[dB]")
plt.xlim(-4,8) 

enter image description here

1 个答案:

答案 0 :(得分:1)

我最终玩弄了:

plt.ylim(4.7*10**-1, 5*10**-1)  

并更改了值,直到找到合适的范围。它现在在y轴上显示5x10 ^ -1。