arviz 0.17.0__py3-none-any.whl → 0.18.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. arviz/__init__.py +3 -2
  2. arviz/data/__init__.py +5 -2
  3. arviz/data/base.py +102 -11
  4. arviz/data/converters.py +5 -0
  5. arviz/data/datasets.py +1 -0
  6. arviz/data/example_data/data_remote.json +10 -3
  7. arviz/data/inference_data.py +26 -25
  8. arviz/data/io_cmdstan.py +1 -3
  9. arviz/data/io_datatree.py +1 -0
  10. arviz/data/io_dict.py +5 -3
  11. arviz/data/io_emcee.py +1 -0
  12. arviz/data/io_numpyro.py +1 -0
  13. arviz/data/io_pyjags.py +1 -0
  14. arviz/data/io_pyro.py +1 -0
  15. arviz/data/io_pystan.py +1 -2
  16. arviz/data/utils.py +1 -0
  17. arviz/plots/__init__.py +1 -0
  18. arviz/plots/autocorrplot.py +1 -0
  19. arviz/plots/backends/bokeh/autocorrplot.py +1 -0
  20. arviz/plots/backends/bokeh/bpvplot.py +8 -2
  21. arviz/plots/backends/bokeh/compareplot.py +8 -4
  22. arviz/plots/backends/bokeh/densityplot.py +1 -0
  23. arviz/plots/backends/bokeh/distplot.py +1 -0
  24. arviz/plots/backends/bokeh/dotplot.py +1 -0
  25. arviz/plots/backends/bokeh/ecdfplot.py +1 -0
  26. arviz/plots/backends/bokeh/elpdplot.py +1 -0
  27. arviz/plots/backends/bokeh/energyplot.py +1 -0
  28. arviz/plots/backends/bokeh/forestplot.py +2 -4
  29. arviz/plots/backends/bokeh/hdiplot.py +1 -0
  30. arviz/plots/backends/bokeh/kdeplot.py +3 -3
  31. arviz/plots/backends/bokeh/khatplot.py +1 -0
  32. arviz/plots/backends/bokeh/lmplot.py +1 -0
  33. arviz/plots/backends/bokeh/loopitplot.py +1 -0
  34. arviz/plots/backends/bokeh/mcseplot.py +1 -0
  35. arviz/plots/backends/bokeh/pairplot.py +1 -0
  36. arviz/plots/backends/bokeh/parallelplot.py +1 -0
  37. arviz/plots/backends/bokeh/posteriorplot.py +1 -0
  38. arviz/plots/backends/bokeh/ppcplot.py +1 -0
  39. arviz/plots/backends/bokeh/rankplot.py +1 -0
  40. arviz/plots/backends/bokeh/separationplot.py +1 -0
  41. arviz/plots/backends/bokeh/traceplot.py +1 -0
  42. arviz/plots/backends/bokeh/violinplot.py +1 -0
  43. arviz/plots/backends/matplotlib/autocorrplot.py +1 -0
  44. arviz/plots/backends/matplotlib/bpvplot.py +1 -0
  45. arviz/plots/backends/matplotlib/compareplot.py +2 -1
  46. arviz/plots/backends/matplotlib/densityplot.py +1 -0
  47. arviz/plots/backends/matplotlib/distcomparisonplot.py +2 -3
  48. arviz/plots/backends/matplotlib/distplot.py +1 -0
  49. arviz/plots/backends/matplotlib/dotplot.py +1 -0
  50. arviz/plots/backends/matplotlib/ecdfplot.py +1 -0
  51. arviz/plots/backends/matplotlib/elpdplot.py +1 -0
  52. arviz/plots/backends/matplotlib/energyplot.py +1 -0
  53. arviz/plots/backends/matplotlib/essplot.py +6 -5
  54. arviz/plots/backends/matplotlib/forestplot.py +3 -4
  55. arviz/plots/backends/matplotlib/hdiplot.py +1 -0
  56. arviz/plots/backends/matplotlib/kdeplot.py +5 -3
  57. arviz/plots/backends/matplotlib/khatplot.py +1 -0
  58. arviz/plots/backends/matplotlib/lmplot.py +1 -0
  59. arviz/plots/backends/matplotlib/loopitplot.py +1 -0
  60. arviz/plots/backends/matplotlib/mcseplot.py +11 -10
  61. arviz/plots/backends/matplotlib/pairplot.py +2 -1
  62. arviz/plots/backends/matplotlib/parallelplot.py +1 -0
  63. arviz/plots/backends/matplotlib/posteriorplot.py +1 -0
  64. arviz/plots/backends/matplotlib/ppcplot.py +1 -0
  65. arviz/plots/backends/matplotlib/rankplot.py +1 -0
  66. arviz/plots/backends/matplotlib/separationplot.py +1 -0
  67. arviz/plots/backends/matplotlib/traceplot.py +2 -1
  68. arviz/plots/backends/matplotlib/tsplot.py +1 -0
  69. arviz/plots/backends/matplotlib/violinplot.py +2 -1
  70. arviz/plots/bfplot.py +7 -6
  71. arviz/plots/bpvplot.py +3 -2
  72. arviz/plots/compareplot.py +3 -2
  73. arviz/plots/densityplot.py +1 -0
  74. arviz/plots/distcomparisonplot.py +1 -0
  75. arviz/plots/dotplot.py +1 -0
  76. arviz/plots/ecdfplot.py +38 -112
  77. arviz/plots/elpdplot.py +2 -1
  78. arviz/plots/energyplot.py +1 -0
  79. arviz/plots/essplot.py +3 -2
  80. arviz/plots/forestplot.py +1 -0
  81. arviz/plots/hdiplot.py +1 -0
  82. arviz/plots/khatplot.py +1 -0
  83. arviz/plots/lmplot.py +1 -0
  84. arviz/plots/loopitplot.py +1 -0
  85. arviz/plots/mcseplot.py +1 -0
  86. arviz/plots/pairplot.py +2 -1
  87. arviz/plots/parallelplot.py +1 -0
  88. arviz/plots/plot_utils.py +1 -0
  89. arviz/plots/posteriorplot.py +1 -0
  90. arviz/plots/ppcplot.py +11 -5
  91. arviz/plots/rankplot.py +1 -0
  92. arviz/plots/separationplot.py +1 -0
  93. arviz/plots/traceplot.py +1 -0
  94. arviz/plots/tsplot.py +1 -0
  95. arviz/plots/violinplot.py +1 -0
  96. arviz/rcparams.py +1 -0
  97. arviz/sel_utils.py +1 -0
  98. arviz/static/css/style.css +2 -1
  99. arviz/stats/density_utils.py +4 -3
  100. arviz/stats/diagnostics.py +4 -4
  101. arviz/stats/ecdf_utils.py +166 -0
  102. arviz/stats/stats.py +16 -32
  103. arviz/stats/stats_refitting.py +1 -0
  104. arviz/stats/stats_utils.py +6 -2
  105. arviz/tests/base_tests/test_data.py +18 -4
  106. arviz/tests/base_tests/test_diagnostics.py +1 -0
  107. arviz/tests/base_tests/test_diagnostics_numba.py +1 -0
  108. arviz/tests/base_tests/test_labels.py +1 -0
  109. arviz/tests/base_tests/test_plots_matplotlib.py +6 -5
  110. arviz/tests/base_tests/test_stats.py +4 -4
  111. arviz/tests/base_tests/test_stats_ecdf_utils.py +153 -0
  112. arviz/tests/base_tests/test_stats_utils.py +4 -3
  113. arviz/tests/base_tests/test_utils.py +3 -2
  114. arviz/tests/external_tests/test_data_numpyro.py +3 -3
  115. arviz/tests/external_tests/test_data_pyro.py +3 -3
  116. arviz/tests/helpers.py +1 -1
  117. arviz/wrappers/__init__.py +1 -0
  118. {arviz-0.17.0.dist-info → arviz-0.18.0.dist-info}/METADATA +10 -9
  119. arviz-0.18.0.dist-info/RECORD +182 -0
  120. {arviz-0.17.0.dist-info → arviz-0.18.0.dist-info}/WHEEL +1 -1
  121. arviz-0.17.0.dist-info/RECORD +0 -180
  122. {arviz-0.17.0.dist-info → arviz-0.18.0.dist-info}/LICENSE +0 -0
  123. {arviz-0.17.0.dist-info → arviz-0.18.0.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,5 @@
1
1
  """Bokeh dotplot."""
2
+
2
3
  import math
3
4
  import warnings
4
5
  import numpy as np
@@ -1,4 +1,5 @@
1
1
  """Bokeh ecdfplot."""
2
+
2
3
  from matplotlib.colors import to_hex
3
4
 
4
5
  from ...plot_utils import _scale_fig_size
@@ -1,4 +1,5 @@
1
1
  """Bokeh ELPDPlot."""
2
+
2
3
  import warnings
3
4
 
4
5
  import bokeh.plotting as bkp
@@ -1,4 +1,5 @@
1
1
  """Bokeh energyplot."""
2
+
2
3
  from itertools import cycle
3
4
 
4
5
  import numpy as np
@@ -15,7 +15,6 @@ from ....rcparams import rcParams
15
15
  from ....stats import hdi
16
16
  from ....stats.density_utils import get_bins, histogram, kde
17
17
  from ....stats.diagnostics import _ess, _rhat
18
- from ....utils import conditional_jit
19
18
  from ...plot_utils import _scale_fig_size
20
19
  from .. import show_layout
21
20
  from . import backend_kwarg_defaults
@@ -277,7 +276,6 @@ class PlotHandler:
277
276
  """Collect labels and ticks from plotters."""
278
277
  val = self.plotters.values()
279
278
 
280
- @conditional_jit(forceobj=True, nopython=False)
281
279
  def label_idxs():
282
280
  labels, idxs = [], []
283
281
  for plotter in val:
@@ -640,7 +638,7 @@ class VarHandler:
640
638
  grouped_data = [[(0, datum)] for datum in self.data]
641
639
  skip_dims = self.combine_dims.union({"chain"})
642
640
  else:
643
- grouped_data = [datum.groupby("chain") for datum in self.data]
641
+ grouped_data = [datum.groupby("chain", squeeze=False) for datum in self.data]
644
642
  skip_dims = self.combine_dims
645
643
 
646
644
  label_dict = OrderedDict()
@@ -648,7 +646,7 @@ class VarHandler:
648
646
  for name, grouped_datum in zip(self.model_names, grouped_data):
649
647
  for _, sub_data in grouped_datum:
650
648
  datum_iter = xarray_var_iter(
651
- sub_data,
649
+ sub_data.squeeze(),
652
650
  var_names=[self.var_name],
653
651
  skip_dims=skip_dims,
654
652
  reverse_selections=True,
@@ -1,4 +1,5 @@
1
1
  """Bokeh hdiplot."""
2
+
2
3
  import numpy as np
3
4
 
4
5
  from ...plot_utils import _scale_fig_size, vectorized_to_hex
@@ -6,7 +6,7 @@ from numbers import Integral
6
6
  import numpy as np
7
7
  from bokeh.models import ColumnDataSource
8
8
  from bokeh.models.glyphs import Scatter
9
- from matplotlib.cm import get_cmap
9
+ from matplotlib import colormaps
10
10
  from matplotlib.colors import rgb2hex
11
11
  from matplotlib.pyplot import rcParams as mpl_rcParams
12
12
 
@@ -188,7 +188,7 @@ def plot_kde(
188
188
 
189
189
  cmap = contourf_kwargs.pop("cmap", "viridis")
190
190
  if isinstance(cmap, str):
191
- cmap = get_cmap(cmap)
191
+ cmap = colormaps[cmap]
192
192
  if isinstance(cmap, Callable):
193
193
  colors = [rgb2hex(item) for item in cmap(np.linspace(0, 1, len(levels_scaled) + 1))]
194
194
  else:
@@ -225,7 +225,7 @@ def plot_kde(
225
225
  else:
226
226
  cmap = pcolormesh_kwargs.pop("cmap", "viridis")
227
227
  if isinstance(cmap, str):
228
- cmap = get_cmap(cmap)
228
+ cmap = colormaps[cmap]
229
229
  if isinstance(cmap, Callable):
230
230
  colors = [rgb2hex(item) for item in cmap(np.linspace(0, 1, 256))]
231
231
  else:
@@ -1,4 +1,5 @@
1
1
  """Bokeh pareto shape plot."""
2
+
2
3
  from collections.abc import Iterable
3
4
 
4
5
  from matplotlib import cm
@@ -1,4 +1,5 @@
1
1
  """Bokeh linear regression plot."""
2
+
2
3
  import numpy as np
3
4
  from bokeh.models.annotations import Legend
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Bokeh loopitplot."""
2
+
2
3
  import numpy as np
3
4
  from bokeh.models import BoxAnnotation
4
5
  from matplotlib.colors import hsv_to_rgb, rgb_to_hsv, to_hex, to_rgb
@@ -1,4 +1,5 @@
1
1
  """Bokeh mcseplot."""
2
+
2
3
  import numpy as np
3
4
  from bokeh.models import ColumnDataSource, Span
4
5
  from bokeh.models.glyphs import Scatter
@@ -1,4 +1,5 @@
1
1
  """Bokeh pairplot."""
2
+
2
3
  import warnings
3
4
  from copy import deepcopy
4
5
  from uuid import uuid4
@@ -1,4 +1,5 @@
1
1
  """Bokeh Parallel coordinates plot."""
2
+
2
3
  import numpy as np
3
4
  from bokeh.models import DataRange1d
4
5
  from bokeh.models.tickers import FixedTicker
@@ -1,4 +1,5 @@
1
1
  """Bokeh Plot posterior densities."""
2
+
2
3
  from numbers import Number
3
4
  from typing import Optional
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Bokeh Posterior predictive plot."""
2
+
2
3
  import numpy as np
3
4
  from bokeh.models.annotations import Legend
4
5
  from bokeh.models.glyphs import Scatter
@@ -1,4 +1,5 @@
1
1
  """Bokeh rankplot."""
2
+
2
3
  import numpy as np
3
4
 
4
5
  from bokeh.models import Span
@@ -1,4 +1,5 @@
1
1
  """Bokeh separation plot."""
2
+
2
3
  import numpy as np
3
4
 
4
5
  from ...plot_utils import _scale_fig_size, vectorized_to_hex
@@ -1,4 +1,5 @@
1
1
  """Bokeh Traceplot."""
2
+
2
3
  import warnings
3
4
  from collections.abc import Iterable
4
5
  from itertools import cycle
@@ -1,4 +1,5 @@
1
1
  """Bokeh Violinplot."""
2
+
2
3
  import numpy as np
3
4
  from bokeh.models.annotations import Title
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib Autocorrplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotib Bayesian p-value Posterior predictive plot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
  from scipy import stats
@@ -1,4 +1,5 @@
1
1
  """Matplotlib Compareplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
 
4
5
  from ...plot_utils import _scale_fig_size
@@ -84,7 +85,7 @@ def plot_compare(
84
85
  else:
85
86
  ax.set_yticks(yticks_pos[::2])
86
87
 
87
- scale = comp_df["scale"][0]
88
+ scale = comp_df["scale"].iloc[0]
88
89
 
89
90
  if insample_dev:
90
91
  p_ic = comp_df[f"p_{information_criterion.split('_')[1]}"]
@@ -1,4 +1,5 @@
1
1
  """Matplotlib Densityplot."""
2
+
2
3
  from itertools import cycle
3
4
 
4
5
  import matplotlib.pyplot as plt
@@ -1,4 +1,5 @@
1
1
  """Matplotlib Density Comparison plot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
 
@@ -88,9 +89,7 @@ def plot_dist_comparison(
88
89
  kwargs = (
89
90
  prior_kwargs
90
91
  if group.startswith("prior")
91
- else posterior_kwargs
92
- if group.startswith("posterior")
93
- else observed_kwargs
92
+ else posterior_kwargs if group.startswith("posterior") else observed_kwargs
94
93
  )
95
94
  for idx2, (
96
95
  var_name,
@@ -1,4 +1,5 @@
1
1
  """Matplotlib distplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  from matplotlib import _pylab_helpers
4
5
  import numpy as np
@@ -1,4 +1,5 @@
1
1
  """Matplotlib dotplot."""
2
+
2
3
  import math
3
4
  import warnings
4
5
  import numpy as np
@@ -1,4 +1,5 @@
1
1
  """Matplotlib ecdfplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  from matplotlib.colors import to_hex
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib ELPDPlot."""
2
+
2
3
  import warnings
3
4
 
4
5
  from matplotlib import cm
@@ -1,4 +1,5 @@
1
1
  """Matplotlib energyplot."""
2
+
2
3
  from itertools import cycle
3
4
 
4
5
  import matplotlib.pyplot as plt
@@ -1,4 +1,5 @@
1
1
  """Matplotlib energyplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
  from scipy.stats import rankdata
@@ -127,11 +128,11 @@ def plot_ess(
127
128
  ax_.annotate(
128
129
  "mean",
129
130
  (text_x, mean_ess_i),
130
- va=text_va
131
- if text_va is not None
132
- else "bottom"
133
- if mean_ess_i >= sd_ess_i
134
- else "top",
131
+ va=(
132
+ text_va
133
+ if text_va is not None
134
+ else "bottom" if mean_ess_i >= sd_ess_i else "top"
135
+ ),
135
136
  **text_kwargs,
136
137
  )
137
138
  ax_.axhline(sd_ess_i, **extra_kwargs)
@@ -1,4 +1,5 @@
1
1
  """Matplotlib forestplot."""
2
+
2
3
  from collections import OrderedDict, defaultdict
3
4
  from itertools import tee
4
5
 
@@ -11,7 +12,6 @@ from ....stats import hdi
11
12
  from ....stats.density_utils import get_bins, histogram, kde
12
13
  from ....stats.diagnostics import _ess, _rhat
13
14
  from ....sel_utils import xarray_var_iter
14
- from ....utils import conditional_jit
15
15
  from ...plot_utils import _scale_fig_size
16
16
  from . import backend_kwarg_defaults, backend_show
17
17
 
@@ -236,7 +236,6 @@ class PlotHandler:
236
236
  """Collect labels and ticks from plotters."""
237
237
  val = self.plotters.values()
238
238
 
239
- @conditional_jit(forceobj=True, nopython=False)
240
239
  def label_idxs():
241
240
  labels, idxs = [], []
242
241
  for plotter in val:
@@ -536,7 +535,7 @@ class VarHandler:
536
535
  grouped_data = [[(0, datum)] for datum in self.data]
537
536
  skip_dims = self.combine_dims.union({"chain"})
538
537
  else:
539
- grouped_data = [datum.groupby("chain") for datum in self.data]
538
+ grouped_data = [datum.groupby("chain", squeeze=False) for datum in self.data]
540
539
  skip_dims = self.combine_dims
541
540
 
542
541
  label_dict = OrderedDict()
@@ -544,7 +543,7 @@ class VarHandler:
544
543
  for name, grouped_datum in zip(self.model_names, grouped_data):
545
544
  for _, sub_data in grouped_datum:
546
545
  datum_iter = xarray_var_iter(
547
- sub_data,
546
+ sub_data.squeeze(),
548
547
  var_names=[self.var_name],
549
548
  skip_dims=skip_dims,
550
549
  reverse_selections=True,
@@ -1,4 +1,5 @@
1
1
  """Matplotlib hdiplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  from matplotlib import _pylab_helpers
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib kdeplot."""
2
+
2
3
  import numpy as np
3
4
  from matplotlib import pyplot as plt
4
5
  from matplotlib import _pylab_helpers
@@ -162,10 +163,11 @@ def plot_kde(
162
163
  ax.grid(False)
163
164
  if contour:
164
165
  qcfs = ax.contourf(x_x, y_y, density, antialiased=True, **contourf_kwargs)
165
- qcs = ax.contour(x_x, y_y, density, **contour_kwargs)
166
+ ax.contour(x_x, y_y, density, **contour_kwargs)
166
167
  if not fill_last:
167
- qcfs.collections[0].set_alpha(0)
168
- qcs.collections[0].set_alpha(0)
168
+ alpha = np.ones(len(qcfs.allsegs), dtype=float)
169
+ alpha[0] = 0
170
+ qcfs.set_alpha(alpha)
169
171
  else:
170
172
  ax.pcolormesh(x_x, y_y, density, **pcolormesh_kwargs)
171
173
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib khatplot."""
2
+
2
3
  import warnings
3
4
 
4
5
  import matplotlib as mpl
@@ -1,4 +1,5 @@
1
1
  """Matplotlib plot linear regression figure."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib loopitplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
  from matplotlib.colors import hsv_to_rgb, rgb_to_hsv, to_hex, to_rgb
@@ -1,4 +1,5 @@
1
1
  """Matplotlib mcseplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
  from scipy.stats import rankdata
@@ -94,22 +95,22 @@ def plot_mcse(
94
95
  ax_.annotate(
95
96
  "mean",
96
97
  (text_x, mean_mcse_i),
97
- va=text_va
98
- if text_va is not None
99
- else "bottom"
100
- if mean_mcse_i > sd_mcse_i
101
- else "top",
98
+ va=(
99
+ text_va
100
+ if text_va is not None
101
+ else "bottom" if mean_mcse_i > sd_mcse_i else "top"
102
+ ),
102
103
  **text_kwargs,
103
104
  )
104
105
  ax_.axhline(sd_mcse_i, **extra_kwargs)
105
106
  ax_.annotate(
106
107
  "sd",
107
108
  (text_x, sd_mcse_i),
108
- va=text_va
109
- if text_va is not None
110
- else "bottom"
111
- if sd_mcse_i >= mean_mcse_i
112
- else "top",
109
+ va=(
110
+ text_va
111
+ if text_va is not None
112
+ else "bottom" if sd_mcse_i >= mean_mcse_i else "top"
113
+ ),
113
114
  **text_kwargs,
114
115
  )
115
116
  if rug:
@@ -1,4 +1,5 @@
1
1
  """Matplotlib pairplot."""
2
+
2
3
  import warnings
3
4
  from copy import deepcopy
4
5
 
@@ -333,7 +334,7 @@ def plot_pair(
333
334
  if reference_values:
334
335
  x_name = flat_var_names[i]
335
336
  y_name = flat_var_names[j + not_marginals]
336
- if x_name and y_name not in difference:
337
+ if (x_name not in difference) and (y_name not in difference):
337
338
  ax[j, i].plot(
338
339
  reference_values_copy[x_name],
339
340
  reference_values_copy[y_name],
@@ -1,4 +1,5 @@
1
1
  """Matplotlib Parallel coordinates plot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib Plot posterior densities."""
2
+
2
3
  from numbers import Number
3
4
 
4
5
  import matplotlib.pyplot as plt
@@ -1,4 +1,5 @@
1
1
  """Matplotlib Posterior predictive plot."""
2
+
2
3
  import logging
3
4
  import platform
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib rankplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib separation plot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib traceplot."""
2
+
2
3
  import warnings
3
4
  from itertools import cycle
4
5
 
@@ -430,7 +431,7 @@ def plot_trace(
430
431
  Line2D(
431
432
  [], [], label=chain_id, **dealiase_sel_kwargs(legend_kwargs, chain_prop, chain_id)
432
433
  )
433
- for chain_id in range(data.dims["chain"])
434
+ for chain_id in range(data.sizes["chain"])
434
435
  ]
435
436
  if combined:
436
437
  handles.insert(
@@ -1,4 +1,5 @@
1
1
  """Matplotlib plot time series figure."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Matplotlib Violinplot."""
2
+
2
3
  import matplotlib.pyplot as plt
3
4
  import numpy as np
4
5
 
@@ -60,7 +61,7 @@ def plot_violin(
60
61
  cols,
61
62
  backend_kwargs=backend_kwargs,
62
63
  )
63
- fig.set_constrained_layout(False)
64
+ fig.set_layout_engine("none")
64
65
  fig.subplots_adjust(wspace=0)
65
66
 
66
67
  ax = np.atleast_1d(ax)
arviz/plots/bfplot.py CHANGED
@@ -38,7 +38,7 @@ def plot_bf(
38
38
  algorithm presented in [1]_.
39
39
 
40
40
  Parameters
41
- -----------
41
+ ----------
42
42
  idata : InferenceData
43
43
  Any object that can be converted to an :class:`arviz.InferenceData` object
44
44
  Refer to documentation of :func:`arviz.convert_to_dataset` for details.
@@ -52,16 +52,16 @@ def plot_bf(
52
52
  Tuple of valid Matplotlib colors. First element for the prior, second for the posterior.
53
53
  figsize : (float, float), optional
54
54
  Figure size. If `None` it will be defined automatically.
55
- textsize: float, optional
55
+ textsize : float, optional
56
56
  Text size scaling factor for labels, titles and lines. If `None` it will be auto
57
57
  scaled based on `figsize`.
58
- plot_kwargs : dicts, optional
58
+ plot_kwargs : dict, optional
59
59
  Additional keywords passed to :func:`matplotlib.pyplot.plot`.
60
- hist_kwargs : dicts, optional
60
+ hist_kwargs : dict, optional
61
61
  Additional keywords passed to :func:`arviz.plot_dist`. Only works for discrete variables.
62
62
  ax : axes, optional
63
63
  :class:`matplotlib.axes.Axes` or :class:`bokeh.plotting.Figure`.
64
- backend :{"matplotlib", "bokeh"}, default "matplotlib"
64
+ backend : {"matplotlib", "bokeh"}, default "matplotlib"
65
65
  Select plotting backend.
66
66
  backend_kwargs : dict, optional
67
67
  These are kwargs specific to the backend being used, passed to
@@ -78,7 +78,7 @@ def plot_bf(
78
78
  References
79
79
  ----------
80
80
  .. [1] Heck, D., 2019. A caveat on the Savage-Dickey density ratio:
81
- The case of computing Bayes factors for regression parameters.
81
+ The case of computing Bayes factors for regression parameters.
82
82
 
83
83
  Examples
84
84
  --------
@@ -92,6 +92,7 @@ def plot_bf(
92
92
  >>> idata = az.from_dict(posterior={"a":np.random.normal(1, 0.5, 5000)},
93
93
  ... prior={"a":np.random.normal(0, 1, 5000)})
94
94
  >>> az.plot_bf(idata, var_name="a", ref_val=0)
95
+
95
96
  """
96
97
  posterior = extract(idata, var_names=var_name).values
97
98
 
arviz/plots/bpvplot.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """Bayesian p-value Posterior/Prior predictive plot."""
2
+
2
3
  import numpy as np
3
4
 
4
5
  from ..labels import BaseLabeller
@@ -230,11 +231,11 @@ def plot_bpv(
230
231
 
231
232
  if flatten_pp is None:
232
233
  if flatten is None:
233
- flatten_pp = list(predictive_dataset.dims.keys())
234
+ flatten_pp = list(predictive_dataset.dims)
234
235
  else:
235
236
  flatten_pp = flatten
236
237
  if flatten is None:
237
- flatten = list(observed.dims.keys())
238
+ flatten = list(observed.dims)
238
239
 
239
240
  if coords is None:
240
241
  coords = {}
@@ -1,4 +1,5 @@
1
1
  """Summary plot for model comparison."""
2
+
2
3
  import numpy as np
3
4
 
4
5
  from ..labels import BaseLabeller
@@ -90,10 +91,10 @@ def plot_compare(
90
91
  References
91
92
  ----------
92
93
  .. [1] Vehtari et al. (2016). Practical Bayesian model evaluation using leave-one-out
93
- cross-validation and WAIC https://arxiv.org/abs/1507.04544
94
+ cross-validation and WAIC https://arxiv.org/abs/1507.04544
94
95
 
95
96
  .. [2] McElreath R. (2022). Statistical Rethinking A Bayesian Course with Examples in
96
- R and Stan, Second edition, CRC Press.
97
+ R and Stan, Second edition, CRC Press.
97
98
 
98
99
  Examples
99
100
  --------
@@ -1,4 +1,5 @@
1
1
  """KDE and histogram plots for multiple variables."""
2
+
2
3
  import warnings
3
4
 
4
5
  from ..data import convert_to_dataset
@@ -1,4 +1,5 @@
1
1
  """Density Comparison plot."""
2
+
2
3
  import warnings
3
4
  from ..labels import BaseLabeller
4
5
  from ..rcparams import rcParams
arviz/plots/dotplot.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """Plot distribution as dot plot or quantile dot plot."""
2
+
2
3
  import numpy as np
3
4
 
4
5
  from ..rcparams import rcParams