Skip to content

Commit 4ae2886

Browse files
committed
[Nyquist-plot] Add labels to figure
1 parent 92d172f commit 4ae2886

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

control/freqplot.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ def gen_zero_centered_series(val_min, val_max, period):
324324
return mags, phases, omegas
325325

326326

327-
def nyquist_plot(syslist, omega=None, Plot=True, color=None,
328-
labelFreq=0, *args, **kwargs):
327+
def nyquist_plot(syslist, omega=None, Plot=True, color=None, labelFreq=0, *args, **kwargs):
329328
"""
330329
Nyquist plot for a system
331330
@@ -377,6 +376,7 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None,
377376
"or frequency vector. ")
378377
omega = np.logspace(np.log10(omega[0]), np.log10(omega[1]),
379378
num=50, endpoint=True, base=10.0)
379+
380380
for sys in syslist:
381381
if sys.inputs > 1 or sys.outputs > 1:
382382
# TODO: Add MIMO nyquist plots.
@@ -419,9 +419,14 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None,
419419
# np.round() is used because 0.99... appears
420420
# instead of 1.0, and this would otherwise be
421421
# truncated to 0.
422-
plt.text(xpt, ypt,
423-
' ' + str(int(np.round(f / 1000 ** pow1000, 0))) +
424-
' ' + prefix + 'Hz')
422+
plt.text(xpt, ypt, ' ' + str(int(np.round(f / 1000 ** pow1000, 0))) + ' ' +
423+
prefix + 'Hz')
424+
425+
if Plot:
426+
ax = plt.gca()
427+
ax.set_xlabel("Real axis")
428+
ax.set_ylabel("Imaginary axis")
429+
425430
return x, y, omega
426431

427432

0 commit comments

Comments
 (0)