Repository navigation
DOC: Follow up #10720 on plot_params errors, release note and tests - #10726
Merged
bashtage merged 2 commits intoNov 11, 2026
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up to #10720 (
plot_paramsofIRAnalysis.plotandplot_cum_effects, #380). Its review left the points below. The code ofirf_grid_plotis unchanged.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:10720next to `:issue:`380, and it says that a key ofplot_paramsthat is not aLine2Dproperty, which was ignored before, now raisesAttributeError. 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)}raiseAttributeError: Line2D.set() got an unexpected keyword argument 'fontsize'(resp.'figsize') forplotand forplot_cum_effects, and{}andNonegive the default figure.DOC:Theplot_paramsentries ofIRAnalysis.plot,IRAnalysis.plot_cum_effectsandirf_grid_plotlinkmatplotlib.lines.Line2D(matplotlib is inintersphinx_mapping, and itsobjects.invhas the class), state theAttributeErrorand have aversionchanged:: 0.15.1note.TST:test_irf_plot_paramsand its neighbourtest_irf_plot_err_bands_kwargget@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,figsizeandcolorwithfontsize, for both methods, the error names the key) andtest_irf_plot_params_default_style(4 cases:plot_params={}andNoneleave 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
irf_grid_plot. A call with an invalid key fails after the figure was created, so a figure stays open (theclose_figuresfixture closes it in the tests). The review of BUG: Apply plot_params to impulse response curves #10720 also noted thatplot_cum_effects(err_bands=..., stderr_type="bogus")now raisesIndexError, becauseax.lines[0]does not exist when nothing was drawn, where the code before BUG: Apply plot_params to impulse response curves #10720 returned a figure without the curve. Both are left as they are.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 jobpython_310).ax.lines[0].set(**plot_params)makes 18 of the 22irf_plot_paramscases fail (the 12 of BUG: Apply plot_params to impulse response curves #10720 and the 6 newinvalid_keycases); the 4default_stylecases pass, as intended.ruff checkandgit diff --checkpass. 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.
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