Skip to content

BUG: Apply plot_params to impulse response curves - #10720

Merged
bashtage merged 1 commit into
statsmodels:mainfrom
Mohammed-AB:codex/irf-plot-styling
Nov 11, 2026
Merged

bashtage merged 1 commit into
statsmodels:mainfrom
Mohammed-AB:codex/irf-plot-styling

Conversation

@Mohammed-AB

Copy link
Copy Markdown

IRAnalysis.plot and plot_cum_effects accept plot_params, but irf_grid_plot ignores it. Apply these properties to the response curves, including Matplotlib aliases; confidence bands and reference lines keep their existing styles.

Closes #380: figsize is already forwarded by the current implementation, and this fixes the remaining plot_params problem.

Validation:

  • All 12 new regression cases fail before the fix and pass afterwards.

  • Full statsmodels/tsa/vector_ar/tests directory: 269 passed.

  • Tests verify both plotting methods, long and short property names, no/asymptotic/precomputed simulation bands, unchanged numerical values and other line styles, and unchanged caller options.

  • Coverage confirms execution of the new functional line.

  • Repository-wide Ruff and git diff --check passed.

  • Focused Sphinx HTML build of all changed API docstrings and guide/release-note passages passed with warnings treated as errors. The full documentation-site build and full statsmodels test suite were not completed.

  • closes IRF plotting from VARResults #380

  • tests added / passed.

  • code/documentation is well formatted.

  • properly formatted commit message.

AI Disclosure

Contributions must comply with the statsmodels AI Policy.

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    Tool(s): OpenAI Codex.
    Used for: reproducing the bug, implementing the fix, writing tests and documentation, running validation, and preparing this submission after human review.
    I have personally read, understood, and can explain every line of this diff, and
    have verified the statistical/numerical correctness of the change.

@bashtage

Copy link
Copy Markdown
Member

LGTM. Thanks.

@bashtage
bashtage merged commit 4c0a1cd into statsmodels:main Nov 11, 2026
14 checks passed
bashtage added a commit that referenced this pull request Nov 11, 2026
#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]>
bashtage added a commit that referenced this pull request Nov 11, 2026
#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 #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 added a commit that referenced this pull request Nov 11, 2026
DOC: Follow up #10720 on plot_params errors, release note and tests
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.

IRF plotting from VARResults

2 participants