【发布时间】:2021-10-25 09:22:15
【问题描述】:
我想将我绘制的这条趋势线延伸到右侧。 到目前为止的代码如下:
import matplotlib.pyplot as plt
import yfinance as yf
df = yf.download('aapl', '2020-01-01', '2021-01-01')
df1 = df[df.index > '2020-06-01']
df2 = df[df.index < '2020-06-02']
lowest2 = df1[df1.Close == df1.Close.min()]
lowest1 = df2[df2.Close == df2.Close.min()]
fig, ax = plt.subplots(figsize= (10, 6))
ax.plot(df.index, df.Close)
ax.plot([lowest1.index[0], lowest2.index[0]], [lowest1.Low[0], lowest2.Low[0]])
ax.set_xlim(df.index[0], df.index[-1])
plt.show()
如果有人能指出我正确的方向,我将不胜感激。
【问题讨论】:
标签: pandas numpy matplotlib