mplfinance 中 plt.scatter 的等价物是什么???
我正在使用 mpl Finance 绘制股票价格图表。
def graph():
file = 'prices1.xlsx'
data = pd.read_excel(file, sheet_name = stockQuote)
data.Date = pd.to_datetime(data.Date)
data = data.set_index('Date')
mpf.plot(data, type = 'candle', mav = (100), tight_layout = True)
This
graph('AAPL')
应该让我看到 AAPL 价格的烛台图。
我还有另一个 Excel 表格,其中包含买入和卖出价格。看起来像这样
myPrices = pd.read_excel('transactions.xlsx')
Date |
Symbol |
Action |
Price |
2020-03-20 |
AAPL |
Buy |
80 |
2021-03-05 |
AAPL |
Sell |
120 |
2020-03-20 |
TSLA |
Buy |
400 |
我知道 matplotlib 有这个:
plt.scatter(myPrices.index, myPrices['Buy'], label = 'Buy', market = '^', color = 'green')
plt.scatter(myPrices.index, myPrices['Sell'], label = 'Sell', market = 'v', color = 'red')
因为我想绘制“AAPL”图表,所以我想读取 transaction.xlsx 中的日期,其中 Symbol =“AAPL”。当我买入时,我想在 MPLFINANCE GRAPH 中用绿色箭头 ^ 表示,当我卖出时用红色箭头 v 表示。不过,我只知道matplotlib中的这个方法。 mplfinance 是否有等效项?请帮忙T T