8000 Adding circle labels by default · python-control/python-control@2168b10 · GitHub
[go: up one dir, main page]

Skip to content
< 8000 /react-partial>

Commit 2168b10

Browse files
wueestrymurrayrm
authored andcommitted
Adding circle labels by default
1 parent c8cf6c3 commit 2168b10

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

control/freqplot.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,27 +1861,36 @@ def _parse_linestyle(style_name, allow_false=False):
18611861

18621862
# Mark the -1 point
18631863
plt.plot([-1], [0], 'r+')
1864-
1864+
18651865
theta = np.linspace(0, 2*np.pi, 100)
18661866
cos = np.cos(theta)
18671867
sin = np.sin(theta)
1868+
label_pos = 15
18681869

18691870
if unit_circle:
18701871
plt.plot(cos, sin, color="black", linestyle='dashed', linewidth=1)
18711872

18721873
if ms_circles is not None:
18731874
for ms in ms_circles:
1874-
plt.plot(-1 + (1/ms)*cos, (1/ms)*sin, color="black", linestyle="dashed", linewidth=1)
1875-
1875+
pos_x = -1 + (1/ms)*cos
1876+
pos_y = (1/ms)*sin
1877+
plt.plot(pos_x, pos_y, color="black", linestyle="dashed", linewidth=1)
1878+
plt.text(pos_x[label_pos], pos_y[label_pos], ms)
1879+
18761880
if mt_circles is not None:
18771881
for mt in mt_circles:
18781882
if mt != 1:
18791883
ct = -mt**2/(mt**2-1) # Mt center
18801884
rt = mt/(mt**2-1) # Mt radius
1881-
plt.plot(ct+rt*cos, rt*sin, color="black", linestyle="dashed", linewidth=1)
1885+
pos_x = ct+rt*cos
1886+
pos_y = rt*sin
1887+
plt.plot(pos_x, pos_y, color="black", linestyle="dashed", linewidth=1)
1888+
plt.text(pos_x[label_pos], pos_y[label_pos], mt)
18821889
else:
18831890
_, _, ymin, ymax = plt.axis()
1891+
pos_y = np.linspace(ymin, ymax, 100)
18841892
plt.vlines(-0.5, ymin=ymin, ymax=ymax, colors="black", linestyles="dashed", linewidth=1)
1893+
plt.text(-0.5, pos_y[label_pos], 1)
18851894

18861895
# Label the frequencies of the points
18871896
if label_freq:

0 commit comments

Comments
 (0)
0