Skip to content

Commit efc975f

Browse files
committed
Adding circle labels by default
1 parent df60d2a commit efc975f

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
@@ -1870,27 +1870,36 @@ def _parse_linestyle(style_name, allow_false=False):
18701870

18711871
# Mark the -1 point
18721872
plt.plot([-1], [0], 'r+')
1873-
1873+
18741874
theta = np.linspace(0, 2*np.pi, 100)
18751875
cos = np.cos(theta)
18761876
sin = np.sin(theta)
1877+
label_pos = 15
18771878

18781879
if unit_circle:
18791880
plt.plot(cos, sin, color="black", linestyle='dashed', linewidth=1)
18801881

18811882
if ms_circles is not None:
18821883
for ms in ms_circles:
1883-
plt.plot(-1 + (1/ms)*cos, (1/ms)*sin, color="black", linestyle="dashed", linewidth=1)
1884-
1884+
pos_x = -1 + (1/ms)*cos
1885+
pos_y = (1/ms)*sin
1886+
plt.plot(pos_x, pos_y, color="black", linestyle="dashed", linewidth=1)
1887+
plt.text(pos_x[label_pos], pos_y[label_pos], ms)
1888+
18851889
if mt_circles is not None:
18861890
for mt in mt_circles:
18871891
if mt != 1:
18881892
ct = -mt**2/(mt**2-1) # Mt center
18891893
rt = mt/(mt**2-1) # Mt radius
1890-
plt.plot(ct+rt*cos, rt*sin, color="black", linestyle="dashed", linewidth=1)
1894+
pos_x = ct+rt*cos
1895+
pos_y = rt*sin
1896+
plt.plot(pos_x, pos_y, color="black", linestyle="dashed", linewidth=1)
1897+
plt.text(pos_x[label_pos], pos_y[label_pos], mt)
18911898
else:
18921899
_, _, ymin, ymax = plt.axis()
1900+
pos_y = np.linspace(ymin, ymax, 100)
18931901
plt.vlines(-0.5, ymin=ymin, ymax=ymax, colors="black", linestyles="dashed", linewidth=1)
1902+
plt.text(-0.5, pos_y[label_pos], 1)
18941903

18951904
# Label the frequencies of the points
18961905
if label_freq:

0 commit comments

Comments
 (0)