在股市分析裡,除了觀察股價的漲跌,成交量也是很重要的指標。成交量代表一段時間內的交易總數,可以幫助我們判斷市場的熱度,以及股價上漲或下跌背後的力量。那今天製作成交量長條圖。
plt.figure(figsize=(12, 6))
plt.bar(df['Date'], df['Volume'], color='gray')
plt.title('台積電 (2330) 成交量長條圖', fontsize=16)
plt.xlabel('日期', fontsize=12)
plt.ylabel('成交量', fontsize=12)
plt.grid(True)
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
plt.figure(figsize=(12, 6))
plt.bar(df['Date'], df['Volume'], color='gray')
plt.title('台積電 (2330) 成交量長條圖', fontsize=16)
plt.xlabel('日期', fontsize=12)
plt.ylabel('成交量', fontsize=12)
plt.grid(True)
plt.xticks(rotation=45)
這幾行程式碼的作用是:
那今天就先這樣。