Skip to content

Arrow head length and head width option is added in nyquist_plot function #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions control/freqplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,9 @@ def gen_zero_centered_series(val_min, val_max, period):
# Nyquist plot
#

def nyquist_plot(syslist, omega=None, Plot=True, color=None,
labelFreq=0, *args, **kwargs):
def nyquist_plot(syslist, omega=None, Plot=True,
labelFreq=0, arrowhead_length=0.1, arrowhead_width=0.1,
color=None, *args, **kwargs):
"""
Nyquist plot for a system

Expand All @@ -452,6 +453,8 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None,
Used to specify the color of the plot
labelFreq : int
Label every nth frequency on the plot
arrowhead_width : arrow head width
arrowhead_length : arrow head length
*args
Additional arguments for :func:`matplotlib.plot` (color, linestyle, etc)
**kwargs:
Expand Down Expand Up @@ -511,12 +514,14 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None,
ax = plt.gca()
# Plot arrow to indicate Nyquist encirclement orientation
ax.arrow(x[0], y[0], (x[1]-x[0])/2, (y[1]-y[0])/2, fc=c, ec=c,
head_width=0.2, head_length=0.2)
head_width=arrowhead_width,
head_length=arrowhead_length)

plt.plot(x, -y, '-', color=c, *args, **kwargs)
ax.arrow(
x[-1], -y[-1], (x[-1]-x[-2])/2, (y[-1]-y[-2])/2,
fc=c, ec=c, head_width=0.2, head_length=0.2)
fc=c, ec=c, head_width=arrowhead_width,
head_length=arrowhead_length)

# Mark the -1 point
plt.plot([-1], [0], 'r+')
Expand Down