Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Visualization of realization of 2D dirichlet random variable with area plot that shows uncertainty.
import numpy as np
import scipy.stats as st
import matplotlib.pyplot as plt'ggplot')
pmat = np.vstack([np.linspace(1, 20, 20),
np.linspace(2, 10, 20),
np.linspace(3, 5, 20)]).T
p = np.asarray([st.dirichlet.rvs(p_, 200) for p_ in pmat])
_, ax = plt.subplots(1, 1, figsize=(10, 5))
C = ['C0', 'C1', 'C2']
for j in range(200):
pvec = p[:, j, :]
pvec_ = np.hstack([np.zeros((20, 1)), np.cumsum(pvec, axis=1)])
for i in range(3):
pvec_[:, i],
pvec_[:, i+1],
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment