Skip to content

Commit 874d52e

Browse files
authored
Arrow head length and head width option is added in nyquist_plot function (#379)
Add option to change Nyquist plot arrow size: * Nyquist_plot changed to accommodate arrow size * color option is added
1 parent dab8ff6 commit 874d52e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

control/freqplot.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,9 @@ def gen_zero_centered_series(val_min, val_max, period):
433433
# Nyquist plot
434434
#
435435

436-
def nyquist_plot(syslist, omega=None, Plot=True, color=None,
437-
labelFreq=0, *args, **kwargs):
436+
def nyquist_plot(syslist, omega=None, Plot=True,
437+
labelFreq=0, arrowhead_length=0.1, arrowhead_width=0.1,
438+
color=None, *args, **kwargs):
438439
"""
439440
Nyquist plot for a system
440441
@@ -452,6 +453,8 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None,
452453
Used to specify the color of the plot
453454
labelFreq : int
454455
Label every nth frequency on the plot
456+
arrowhead_width : arrow head width
457+
arrowhead_length : arrow head length
455458
*args
456459
Additional arguments for :func:`matplotlib.plot` (color, linestyle, etc)
457460
**kwargs:
@@ -511,12 +514,14 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None,
511514
ax = plt.gca()
512515
# Plot arrow to indicate Nyquist encirclement orientation
513516
ax.arrow(x[0], y[0], (x[1]-x[0])/2, (y[1]-y[0])/2, fc=c, ec=c,
514-
head_width=0.2, head_length=0.2)
517+
head_width=arrowhead_width,
518+
head_length=arrowhead_length)
515519

516520
plt.plot(x, -y, '-', color=c, *args, **kwargs)
517521
ax.arrow(
518522
x[-1], -y[-1], (x[-1]-x[-2])/2, (y[-1]-y[-2])/2,
519-
fc=c, ec=c, head_width=0.2, head_length=0.2)
523+
fc=c, ec=c, head_width=arrowhead_width,
524+
head_length=arrowhead_length)
520525

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy