Skip to content

Add polar-axis option to Makie nyquistplot#1065

Open
baggepinnen wants to merge 3 commits into
masterfrom
polar-nyquist
Open

Add polar-axis option to Makie nyquistplot#1065
baggepinnen wants to merge 3 commits into
masterfrom
polar-nyquist

Conversation

@baggepinnen

Copy link
Copy Markdown
Member

Adds a polar keyword option to CSMakie.nyquistplot that draws the Nyquist curve in a Makie.PolarAxis instead of a Cartesian Axis. This provides native polar "graph paper": circles of constant magnitude and rays of constant phase, drawn and re-ticked automatically by Makie when the axis limits change, with correct aspect ratio by construction. Requested in discussion JuliaControl/ControlSystems.jl#1064.

A rlimits keyword (forwarded to PolarAxis) allows limiting the radial axis, which is useful for systems with poles on or near the imaginary axis where the Nyquist curve reaches very large magnitudes.

All existing options (Ms_circles, Mt_circles, unit_circle, critical_point, MIMO grid layout, adaptive downsampling) work in polar mode as well; Cartesian coordinates are converted point-wise to (angle, radius).

Example

using ControlSystemsBase, GLMakie  # or CairoMakie

P = tf(4, [1, 2, 1, 0])  # 4 / (s(s+1)²)
CSMakie.nyquistplot(P; polar=true, rlimits=(0, 3), unit_circle=true, Ms_circles=[1.7])

🤖 Generated with Claude Code

https://claude.ai/code/session_01KU255FUfQGyZa2cziDYf7C

baggepinnen and others added 2 commits July 10, 2026 19:48
Adds a `polar` keyword to `CSMakie.nyquistplot` that draws the Nyquist
curve in a `Makie.PolarAxis`, providing native polar grid lines (circles
of constant magnitude and rays of constant phase) that adapt to the axis
limits. A `rlimits` keyword allows limiting the radial axis, useful for
systems with poles on or near the imaginary axis.

Requested in discussion #1064

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KU255FUfQGyZa2cziDYf7C
Phase lag of a typical system now reads as a negative angle in the lower
half-plane, following the convention of polar Nyquist charts in textbooks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KU255FUfQGyZa2cziDYf7C
@JuliaControlBot

Copy link
Copy Markdown

This is an automated message.
Plots were compared to references. 4/11 images have changed, see differences below.
After pulling this PR, please update the reference images by creating a PR to ControlExamplePlots.jl here.

Difference Reference Image New Image
✔️ 0.0 Reference New
✔️ 0.0 Reference New
✔️ 0.0 Reference New
✔️ 0.0 Reference New

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.68%. Comparing base (b2b7dc4) to head (856cb66).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ntrolSystemsBase/ext/ControlSystemsBaseMakieExt.jl 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1065      +/-   ##
==========================================
+ Coverage   91.64%   91.68%   +0.04%     
==========================================
  Files          42       42              
  Lines        5660     5712      +52     
==========================================
+ Hits         5187     5237      +50     
- Misses        473      475       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Allows customizing grid density and appearance through PolarAxis/Axis
attributes such as rticks, thetaminorticks and rminorgridvisible.
Unknown keyword arguments now error instead of being silently ignored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KU255FUfQGyZa2cziDYf7C
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.

2 participants