Skip to content

Commit 9179e89

Browse files
committed
Add linestyle argument to nichols grid function
1 parent f4e3a1c commit 9179e89

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

control/nichols.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ def nichols_plot(sys_list, omega=None, grid=True):
111111
nichols_grid()
112112

113113

114-
# TODO: Consider making line style configurable
115-
def nichols_grid(cl_mags=None, cl_phases=None):
114+
def nichols_grid(cl_mags=None, cl_phases=None, line_style='dotted'):
116115
"""Nichols chart grid
117116
118117
Plots a Nichols chart grid on the current axis, or creates a new chart
@@ -126,6 +125,8 @@ def nichols_grid(cl_mags=None, cl_phases=None):
126125
cl_phases : array-like (degrees), optional
127126
Array of closed-loop phases defining the iso-phase lines on a custom
128127
Nichols chart. Must be in the range -360 < cl_phases < 0
128+
line_style : string, optional
129+
.. seealso:: https://matplotlib.org/gallery/lines_bars_and_markers/linestyles.html
129130
130131
Returns
131132
-------
@@ -192,10 +193,10 @@ def nichols_grid(cl_mags=None, cl_phases=None):
192193

193194
for phase_offset in phase_offsets:
194195
# Draw M and N contours
195-
plt.plot(m_phase + phase_offset, m_mag, color='gray',
196-
linestyle='dotted', zorder=0)
197-
plt.plot(n_phase + phase_offset, n_mag, color='gray',
198-
linestyle='dotted', zorder=0)
196+
plt.plot(m_phase + phase_offset, m_mag, color='lightgray',
197+
linestyle=line_style, zorder=0)
198+
plt.plot(n_phase + phase_offset, n_mag, color='lightgray',
199+
linestyle=line_style, zorder=0)
199200

200201
# Add magnitude labels
201202
for x, y, m in zip(m_phase[:][-1] + phase_offset, m_mag[:][-1], cl_mags):

0 commit comments

Comments
 (0)