Skip to content

DOC: fix docstring parameters that the functions do not accept - #1274

Open
dylanpulver wants to merge 2 commits into
python-control:mainfrom
dylanpulver:doc/phantom-parameter-names
Open

dylanpulver wants to merge 2 commits into
python-control:mainfrom
dylanpulver:doc/phantom-parameter-names

Conversation

@dylanpulver

Copy link
Copy Markdown

Two Parameters entries name an argument the function does not take.

  • ControlPlot.set_plot_title documents fig, but the method is (self, title, frame='axes') and uses self.figure, so there is no way to pass it. The whole Parameters block came across from suptitle(), which is deprecated in favour of this method and does take fig.
  • phase_plot documents func; the parameter was renamed to odefun, so phase_plot(func=...) raises TypeError. The usage lines above it still read phase_plot(func, ...), which works because that form is positional.

One thing I did not change, because it is your call rather than mine. The same block documents **kwargs : matplotlib.pyplot.suptitle keywords, optional, and set_plot_title neither accepts nor forwards them: the body calls _update_plot_title(title, fig=self.figure, frame=frame, use_existing=False). So deprecating suptitle dropped that passthrough. Removing the entry and restoring the passthrough are both defensible, and the second is a behaviour change, so I left it alone. Happy to follow up with whichever you prefer.

Docstrings only. ruff check control/ctrlplot.py control/phaseplot.py passes.

@slivingston slivingston left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slivingston

Copy link
Copy Markdown
Member

Besides my requests, these changes are good to merge. For posterity,

  • use of "func" originates in commit 53dfeb0
  • fig parameter was removed in commit 89cda3d

Regarding **kwargs, _update_plot_title() is used by code outside of this module (ctrlplot.py), and there are calls with arguments that appear in **kwargs, so the passthrough was not "dropped." It simply is not available through set_plot_title(). Therefore, I think the most useful docstring change would be to move the **kwargs description from set_plot_title() to _update_plot_title().

ControlPlot.set_plot_title documented `fig`, but the method takes
(self, title, frame) and uses self.figure, so there is no way to pass it.
The Parameters block came across from suptitle(), which is deprecated in
favour of this method and does take fig.

phase_plot documented `func`; the parameter was renamed to `odefun`, so
the keyword form raised TypeError.
Per review: the passthrough was never dropped, it is simply not reachable
through ControlPlot.set_plot_title. _update_plot_title is called from
outside this module with arguments that land in **kwargs, so that is
where the description belongs. It had no docstring, so the entries for
its other parameters come from the module: fig from `if fig is None:
fig = plt.gcf()`, frame from the wording already used in
set_plot_title, and use_existing from the title-merging branch below.
@dylanpulver
dylanpulver force-pushed the doc/phantom-parameter-names branch from d31ffaf to ec4fd52 Compare November 13, 2026 00:21
@slivingston

Copy link
Copy Markdown
Member

@dylanpulver Thanks. Please disclose use of tools consistent with https://numpy.org/doc/stable/dev/ai_policy.html. Since you are opening a very large number of PRs in other, seemingly unrelated repositories, I assume you are using some (or all) automation.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 94.757% (+0.01%) from 94.747% — dylanpulver:doc/phantom-parameter-names into python-control:main

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.

3 participants