我想在其中制作一个包含三个不同图表的情节。这是我的代码:
import numpy as np
from math import sqrt
import matplotlib.pyplot as plt
def make_sequence(N:int, alpha:float, beta:float) -> np.ndarray:
z_n = np.empty((N, 1))
for n in range(1, N+1):
z_n[n-1] = alpha*(1+sqrt(3))**n + beta*(1-sqrt(3))**n
return z_n
x0 = make_sequence(50, 0.0, 1.0)
x1 = make_sequence(50, 0.0, 99.0)
x2 = make_sequence(50, 5.0, 5.0)
plt.plot(x0, 'bo')
plt.plot(x1, 'ro')
plt.plot(x2, 'go')
plt.axis([0, 50, -2, 2])
plt.title(r'$z_1,...,z_{50}$')
plt.xlabel('n')
plt.legend([r'$\alpha =0$, $\beta =1$', r'$\alpha =0$, $\beta =99$', r'$\alpha =5$, $\beta =5$'])
plt.show()
为什么x2没有显示在情节上?
如果我尝试单独绘制x2,则只显示我是否删除了轴缩放命令。