In [ ]:
import daft
import matplotlib
matplotlib.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})
matplotlib.rc('text', usetex=True)
%matplotlib inline

In [ ]:
#initialize the PGM
pgm = daft.PGM([2, 3.5], origin=[0, 0])

#desired hyperparameters
pgm.add_node(daft.Node("dist", r"$\phi$", 1., 3.))

#latent variables/parameters
pgm.add_node(daft.Node("redshift", r"$z_{j}$", 1., 2.))

#data
pgm.add_node(daft.Node("photometry", r"$\vec{d}_{j}$", 1., 1., observed=True))

# Add in the edges.
pgm.add_edge("dist", "redshift")
pgm.add_edge("redshift", "photometry")

# plates
pgm.add_plate(daft.Plate([0.45, 0.4, 1.075, 2.15], label=r"$j = 1, \cdots, J$", bbox={"color": "none"}))

# Render and save.
pgm.render()
pgm.figure.show()
pgm.figure.savefig('pgm.png', dpi=300)

In [ ]: