I want to plot the beta distribution with beta.pdf(x, a, b)
but I only get the following error:
FloatingPointError: underflow encountered in exp.
This is my code:
x = np.linspace(0, 1, 990)
a=50.5
b=940.5
y = beta.pdf(x, a, b)
plt.title("PDF of Beta (Bell-shape)", fontsize=20)
plt.xlabel("X", fontsize=16)
plt.ylabel("Probability Density", fontsize=16)
plt.plot(x, y, linewidth=3, color='firebrick')
plt.annotate("Beta(50.5,940.5)", xy=(0.15, 2), size = 100, ha='center', va='center', color='firebrick')
fig = plt.gcf()
plt.show()
fig.savefig('my_plot.png',dpi=130)