Skip to content

DOC: Follow up #10720 on plot_params errors, release note and tests - #10726

Merged
bashtage merged 2 commits into
statsmodels:mainfrom
bashtage:wip-irf-plot-params-followup
Nov 11, 2026
Merged

bashtage merged 2 commits into
statsmodels:mainfrom
bashtage:wip-irf-plot-params-followup

Conversation

@bashtage

Copy link
Copy Markdown
Member

Follow up to #10720 (plot_params of IRAnalysis.plot and plot_cum_effects, #380). Its review left the points below. The code of irf_grid_plot is unchanged.

  • tests added / passed.
  • code/documentation is well formatted.
  • properly formatted commit message. See
    NumPy's guide.

Changes

  • DOC: Release note. The bullet sat under "New Features and Enhancements", before the "New functions and methods" sub-heading, where no other bullet is, although the change fixes an argument that was accepted and ignored. It is now at the end of "Bug Fixes", "Time series analysis", reworded as a fix, with :pr:10720 next to `:issue:`380, and it says that a key of plot_params that is not a Line2D property, which was ignored before, now raises AttributeError. Checked with a VAR(2) on simulated data (np.random.default_rng(1234), irf = res.irf(5)): on the code before BUG: Apply plot_params to impulse response curves #10720 every call returned a figure and {"color": "red"} left the curve blue; on this branch {"fontsize": 8} and {"figsize": (4, 4)} raise AttributeError: Line2D.set() got an unexpected keyword argument 'fontsize' (resp. 'figsize') for plot and for plot_cum_effects, and {} and None give the default figure.
  • DOC: The plot_params entries of IRAnalysis.plot, IRAnalysis.plot_cum_effects and irf_grid_plot link matplotlib.lines.Line2D (matplotlib is in intersphinx_mapping, and its objects.inv has the class), state the AttributeError and have a versionchanged:: 0.15.1 note.
  • TST: test_irf_plot_params and its neighbour test_irf_plot_err_bands_kwarg get @pytest.mark.thread_unsafe(reason="uses matplotlib"), as the other matplotlib tests of the file have (pyplot state is global).
  • TST: test_irf_plot_params_invalid_key (6 cases: fontsize, figsize and color with fontsize, for both methods, the error names the key) and test_irf_plot_params_default_style (4 cases: plot_params={} and None leave every line in the default style; this one also passes without BUG: Apply plot_params to impulse response curves #10720 and pins existing behavior).

Not changed

Tests

  • statsmodels/tsa/vector_ar/tests/: 279 passed on Python 3.13 (269 before, plus the 10 new cases) and 243 passed, 36 skipped on Python 3.10 with NumPy 1.23.5 and SciPy 1.8.1 (that environment has no matplotlib, so the matplotlib tests are skipped, as in the Azure job python_310).
  • Mutation: deleting ax.lines[0].set(**plot_params) makes 18 of the 22 irf_plot_params cases fail (the 12 of BUG: Apply plot_params to impulse response curves #10720 and the 6 new invalid_key cases); the 4 default_style cases pass, as intended.
  • ruff check and git diff --check pass. The documentation was not built with Sphinx.

AI Disclosure

Contributions must comply with the statsmodels AI Policy.

Tick exactly one of the following. If AI tools were used, replace the <...>
placeholders in the second option with the tool name(s) and how the tool's output was
used.

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    Tool(s): Claude Code (Claude Sonnet 5.5).
    Used for: reviewing BUG: Apply plot_params to impulse response curves #10720, and writing and checking the follow-up changes.
    I have personally read, understood, and can explain every line of this diff, and
    have verified the statistical/numerical correctness of the change.

🤖 Generated with Claude Code

bashtage and others added 2 commits November 11, 2026 10:04
statsmodels#10720 applies plot_params to the impulse response curves in
IRAnalysis.plot and plot_cum_effects. Before, plot_params was accepted and
ignored, so the release note belongs under "Bug Fixes", "Time series
analysis", not under "New Features and Enhancements". It now also lists
:pr:`10720` and says that keys of plot_params that are not Line2D
properties, which were ignored before, now raise an AttributeError.

The plot_params entries of IRAnalysis.plot, IRAnalysis.plot_cum_effects and
irf_grid_plot link matplotlib.lines.Line2D (matplotlib is in the intersphinx
mapping), state the AttributeError and add a versionchanged 0.15.1 note.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
statsmodels#10720 applies plot_params to the response curves, so keys that are not
Line2D properties now raise an AttributeError where they were ignored. Add
test_irf_plot_params_invalid_key (fontsize and figsize, for plot and
plot_cum_effects, the error names the key) and
test_irf_plot_params_default_style (plot_params={} and None leave the
response curves and the other lines in the default style; this one also
passes without the change of statsmodels#10720). The figure left open by the failed call
is closed by the close_figures fixture.

test_irf_plot_params and test_irf_plot_err_bands_kwarg lacked the
thread_unsafe mark that the other matplotlib tests of the file carry, although
pyplot state is global: add it to both.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@bashtage
bashtage marked this pull request as ready for review November 11, 2026 10:16
@bashtage
bashtage merged commit ce58056 into statsmodels:main Nov 11, 2026
9 of 11 checks passed
@bashtage
bashtage deleted the wip-irf-plot-params-followup branch November 20, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant