daft-dev / daft

Render probabilistic graphical models using matplotlib
https://docs.daft-pgm.org
MIT License
675 stars 118 forks source link

subplots? #146

Open benslack19 opened 2 years ago

benslack19 commented 2 years ago

Hi, I'm looking to make multiple DAGs in one figure. Is there a way to do subplots?

dfm commented 2 years ago

Unfortunately this is not currently supported. It seems like it wouldn't be too hard to add, but I don't know of any plan to do it.

If you (or anyone else) are interested in looking into this, the issue is that reset_figure is called in pgm.render() which removes any previously defined figure:

https://github.com/daft-dev/daft/blob/5d3d8c7aec6b066863dfa7404ea0a5b91304af82/daft.py#L456

We'd need to figure out how to remove that call to get this to work!

nstarman commented 1 year ago

Rather than making a new figure, render could take an ax argument. If not provided it would make a new figure and axes.