Skip to content

Commit d38b4f1

Browse files
committed
Use arviz for plotting
1 parent c613106 commit d38b4f1

File tree

13 files changed

+31
-1688
lines changed

13 files changed

+31
-1688
lines changed

pymc3/plots/__init__.py

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
1-
from .autocorrplot import autocorrplot
2-
from .compareplot import compareplot
3-
from .forestplot import forestplot
4-
from .kdeplot import kdeplot
5-
from .posteriorplot import plot_posterior, plot_posterior_predictive_glm
6-
from .traceplot import traceplot
7-
from .energyplot import energyplot
8-
from .densityplot import densityplot
9-
from .pairplot import pairplot
1+
try:
2+
import arviz as az
3+
except ImportError: # arviz is optional, throw exception when used
4+
5+
class _ImportWarner:
6+
def __init__(self, attr):
7+
self.attr = attr
8+
9+
def __call__(self, *args, **kwargs):
10+
raise ImportError(
11+
f"ArviZ is not installed. In order to use `{self.attr}`:\npip install arviz"
12+
)
13+
14+
class _ArviZ:
15+
def __getattr__(self, attr):
16+
return _ImportWarner(attr)
17+
18+
az = _ArviZ()
19+
20+
21+
autocorrplot = az.plot_autocorr
22+
compareplot = az.plot_compare
23+
forestplot = az.plot_forest
24+
kdeplot = az.plot_kde
25+
plot_posterior = az.plot_posterior
26+
traceplot = az.plot_trace
27+
energyplot = az.plot_energy
28+
densityplot = az.plot_density
29+
pairplot = az.plot_pair
30+
31+
from .posteriorplot import plot_posterior_predictive_glm

pymc3/plots/artists.py

Lines changed: 0 additions & 172 deletions
This file was deleted.

pymc3/plots/autocorrplot.py

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)