Skip to content

[ar1_turningpts] arviz 1.x: az.plot_trace silently drops the density panels — plot_trace_dist is the 0.x equivalent #1021

Description

@mmcky

Summary

Under arviz 1.x, az.plot_trace and az.plot_trace_dist are two different plots, and the name that carries over from arviz 0.x is the wrong one. lectures/ar1_turningpts.md was correctly migrated to plot_trace_dist in #584, but PR #1020 changes it back to plot_trace, which silently drops the marginal density panels from the figure. lectures/ar1_bayes.md has the same problem, left over from the #930 build fix, and was never migrated.

Neither case fails the build — the figure just quietly loses half its content.

What changed in arviz 1.x

Straight from the 1.2.0 docstrings:

function arviz 1.x docstring equivalent in arviz 0.x
az.plot_trace "Plot iteration versus sampled values." no direct equivalent — trace lines only
az.plot_trace_dist "Plot 1D marginal distributions and iteration versus sampled values." this is the old az.plot_trace

So a lecture that used az.plot_trace under 0.x and still calls az.plot_trace under 1.x renders a strictly smaller figure than it used to, with no warning and no error. plot_trace_dist is the call that preserves the original output.

Affected lectures

lecture current call status
lectures/ar1_turningpts.md (in draw_from_posterior) az.plot_trace_dist(plot_data, var_names=['ρ', 'σ']) on mainaz.plot_trace(...) in #1020 regression introduced by #1020; main is currently correct
lectures/ar1_bayes.md (two call sites, az.plot_trace(trace) and az.plot_trace(trace_y0)) az.plot_trace never migrated; densities missing on main today

How this happened

The three commits tell the story:

Suggested fix

Standardise on az.plot_trace_dist in both lectures: revert the ar1_turningpts.md line in #1020 back to plot_trace_dist, and update the two ar1_bayes.md call sites to match. Both lectures install arviz unpinned at runtime, so neither should pin a version — fix forward to the 1.x API, consistent with how the other in-lecture pip packages are handled.

Worth a short comment at the call site noting that plot_trace_dist is the 1.x name for what used to be plot_trace, so the next person reading it doesn't "fix" it again.

Related

Same arviz 0.x → 1.x class of breakage as the az.from_dict and az.summary failures in sargent_surico.md, diagnosed in #1020. Earlier instances: #929, #935.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is wrong or broken in a lecture or buildcontent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions