MilkyCode
MilkyCode

Reputation: 35

Y-axis values not showing in matplotlib.pyplot plot

My plot is not showing any indication of what the order of magnitude of my y-values are on the axis. How do I force python to indicate some values on the y-axis?

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

Upvotes: 2

Views: 2242

Answers (1)

MilkyCode
MilkyCode

Reputation: 35

I ended up playing around with:

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

and changed the values until I found an appropriate range. It now shows 5x10^-1 on the y-axis.

Upvotes: 1

Related Questions