Skip to content

Instantly share code, notes, and snippets.

@kngwyu
Created October 8, 2019 03:57
Show Gist options
  • Save kngwyu/25034c9f212a2b2e23bb6aefbe556232 to your computer and use it in GitHub Desktop.
Save kngwyu/25034c9f212a2b2e23bb6aefbe556232 to your computer and use it in GitHub Desktop.
from matplotlib import pyplot as plt
import numpy as np
from scipy.stats import beta
def plot_beta(a, b):
x = np.linspace(beta.ppf(0.01, a, b), beta.ppf(0.99, a, b), 100)
plt.plot(x, beta.pdf(x, a, b), 'r-', lw=5, alpha=0.6, label='beta pdf')
plt.title('α={} β={}'.format(a, b))
plt.show()
if __name__ == '__main__':
for a, b in zip([1.0, 10.0, 1.0], [1.0, 1.0, 10.0]):
plot_beta(a, b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment