Skip to content

Interactive plotly figures: four different answers across the series, two of them broken #354

Description

@mmcky

The style guide has a rule for interactive plotly figures. Nothing in the lecture repos applies it, and the published sites currently show four different behaviours — two of which are broken for readers.

What the style guide says

QuantEcon.manual/manual/styleguide/figures.md endorses plotly figures as "a good way to add interactivity to a lecture", mandates fig.show(renderer="notebook_connected"), and mandates an {only} latex link-back to the website. It also documents the failure mode explicitly: since plotly v6 the default renderer emits only plotly's custom mime type, which jupyter-book and myst-nb cannot render, so the cell output appears as an empty box on the published site.

What the sites actually do

Pattern Where Published result
Bare fig.show() lecture-python-intro/lectures/inequality.md:776 Broken. intro.quantecon.org/inequality.html contains zero Plotly.newPlot — the output div is empty. Line 780 tells the reader the figure "is built using plotly and is available on the website"
Commented out lecture-python.myst/lectures/back_prop.md:534,614; lecture-python-advanced.myst/lectures/BCG_complete_mkts.md:1198; BCG_incomplete_mkts.md:1274,1638,1689,1750,1780 Absent. Eight figures disabled with # fig.show() will provide interactive plot when running; the published pages render zero plotly
go.FigureWidget lecture-datascience.myst/lectures/tools/regression.md:650 Works. datascience.quantecon.org/tools/regression.html renders five
fig.show(renderer="notebook_connected") — the mandated form nowhere Applied in zero lecture files

The inequality.md defect is mirrored in lecture-intro.zh-cn and lecture-wasm.

Why this wants a sweep rather than a one-line fix

The broken case matters most, because the page promises a figure that is not there. But the eight disabled figures are a decision nobody wrote down, and the one pattern that works is a third mechanism the style guide does not mention. Fixing only inequality.md would leave three answers standing.

Suggested shape: apply the mandated renderer wherever a figure should ship; decide explicitly whether the eight disabled figures should be restored or removed along with their dead code; and reconcile go.FigureWidget with the style guide, either as a sanctioned second pattern or as something to migrate.

Surfaced while evaluating #54.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions