def iqplot(data, spec='.', labels=None):
"""Plot signal points.
:param data: complex baseband signal points
:param spec: plot specifier (see :func:`matplotlib.pyplot.plot`)
:param labels: label for each signal point
>>> import arlpy
>>> arlpy.comms.iqplot(arlpy.comms.psk(8))
>>> arlpy.comms.iqplot(arlpy.comms.qam(16), 'rx')
>>> arlpy.comms.iqplot(arlpy.comms.psk(4), labels=['00', '01', '11', '10'])
"""
import matplotlib.pyplot as plt
data = _np.asarray(data)
if labels is None:
plt.plot(data.real, data.imag, spec)
else:
if labels == True:
labels = range(len(data))
for i in range(len(data)):
plt.text(data[i].real, data[i].imag, str(labels[i]))
plt.axis([-2, 2, -2, 2])
plt.grid()
plt.show()
评论列表
文章目录