arviz.plot_mcse(idata, var_names=None, filter_vars=None, coords=None, errorbar=False, grid=None, figsize=None, textsize=None, extra_methods=False, rug=False, rug_kind='diverging', n_points=20, labeller=None, ax=None, rug_kwargs=None, extra_kwargs=None, text_kwargs=None, backend=None, backend_kwargs=None, show=None, **kwargs)[source]#

Plot quantile or local Monte Carlo Standard Error.


Any object that can be converted to an arviz.InferenceData object Refer to documentation of arviz.convert_to_dataset() for details

var_nameslist of variable names, optional

Variables to be plotted. Prefix the variables by ~ when you want to exclude them from the plot.

filter_vars{None, “like”, “regex”}, optional, default=None

If None (default), interpret var_names as the real variables names. If “like”, interpret var_names as substrings of the real variables names. If “regex”, interpret var_names as regular expressions on the real variables names. A la pandas.filter.

coordsdict, optional

Coordinates of var_names to be plotted. Passed to xarray.Dataset.sel()

errorbarbool, optional

Plot quantile value +/- mcse instead of plotting mcse.


Number of rows and columns. Defaults to None, the rows and columns are automatically inferred.

figsize(float, float), optional

Figure size. If None it will be defined automatically.

textsizefloat, optional

Text size scaling factor for labels, titles and lines. If None it will be autoscaled based on figsize.

extra_methodsbool, optional

Plot mean and sd MCSE as horizontal lines. Only taken into account when errorbar=False.


Plot rug plot of values diverging or that reached the max tree depth.


Variable in sample stats to use as rug mask. Must be a boolean variable.


Number of points for which to plot their quantile/local ess or number of subsets in the evolution plot.

labellerLabeller, optional

Class providing the method make_label_vert to generate the labels in the plot titles. Read the Label guide for more details and usage examples.

ax2D array_like of matplotlib Axes or bokeh_figures, optional

A 2D array of locations into which to plot the densities. If not supplied, Arviz will create its own array of plot areas (and return it).


kwargs passed to rug plot in matplotlib.axes.Axes.plot() or bokeh.models.glyphs.Scatter.

extra_kwargsdict, optional

kwargs passed as extra method lines in matplotlib.axes.Axes.axhline() or bokeh.models.Span

text_kwargsdict, optional

kwargs passed to matplotlib.axes.Axes.annotate() for extra methods lines labels. It accepts the additional key x to set xy=(text_kwargs["x"], mcse). text_kwargs are ignored for the bokeh plotting backend.

backendstr, optional

Select plotting backend {“matplotlib”,”bokeh”}. Default “matplotlib”.

backend_kwargsbool, optional

These are kwargs specific to the backend being passed to matplotlib.pyplot.subplots() or bokeh.plotting.figure().

show: bool, optional

Call backend show function.


Passed as-is to matplotlib.axes.Axes.hist() or matplotlib.axes.Axes.plot() in matplotlib depending on the value of kind.

axesmatplotlib axes or bokeh figures

See also


Calculate Markov Chain Standard Error statistic.



Vehtari et al. (2021). Rank-normalization, folding, and localization: An improved Rhat for assessing convergence of MCMC. Bayesian analysis, 16(2):667-718.


Plot quantile Monte Carlo Standard Error.

>>> import arviz as az
>>> idata = az.load_arviz_data("centered_eight")
>>> coords = {"school": ["Deerfield", "Lawrenceville"]}
>>> az.plot_mcse(
...     idata, var_names=["mu", "theta"], coords=coords
... )