嘿,有人可以幫我嗎?
我想填充線條之間的區域。我已經完成了兩個領域,但另一個領域,我不知道我是怎么做到的。
這是我的代碼:
import numpy as np
import matplotlib.pyplot as plt
# Constellation:
M = 8
A = 1 # Amplitude
m = np.arange(0,M) #all information symbols m={0,1,...,M-1}
I = A*np.cos(m/M*2*np.pi)
Q = A*np.sin(m/M*2*np.pi)
constellation = I 1j*Q #reference constellation
# Plotting the fig:
fig,ax = plt.subplots(figsize=[10,10])
ax.plot([-1/2,0],[-1,0],'k--')
ax.plot([1/2,0],[-1,0],'k--')
ax.plot([1/2,0],[1,0],'k--')
ax.plot([-1/2,0],[1,0],'k--')
ax.plot([-1,0],[-1/2,0],'k--')
ax.plot([1,0],[1/2,0],'k--')
ax.plot([-1,0],[1/2,0],'k--')
ax.plot([1,0],[-1/2,0],'k--')
plt.fill_between([0,-1], [0,-1/2],[0,1/2],color='gray',alpha=0.5)
plt.fill_between([0,1], [0,-1/2],[0,1/2],color='gray',alpha=0.5)
circle = plt.Circle((0,0),1,color='k',linestyle='--',fill=False)
ax.add_patch(circle)
ax.scatter(np.real(constellation),np.imag(constellation),c='c',s=20**2)
ax.set_xlabel(r'I-Axis $Real\{x\}$')
ax.set_ylabel(r'Q-Axis $Imag\{x\}$')
plt.tight_layout();
這是我當前的輸出:
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/473866.html
標籤:Python matplotlib 数字