如何使用 Matplotlib 中的 pandas.plot() 更改標記大小?


要使用pandas.plot()更改標記大小,我們可以採取以下步驟 −

  • 設定圖形大小,調整子圖之間和周圍的邊距。
  • 建立一個帶有三列的 Pandas 資料幀,col1、col2col3。
  • 使用帶有marker="*"markersize=15pandas.plot()
  • 要顯示圖形,請使用show()方法。

示例

import matplotlib.pyplot as plt
import pandas as pd

plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True

df = pd.DataFrame([[2, 1, 4], [5, 2, 1], [4, 0, 1]], columns=['col1', 'col2', 'col3'])

df.plot(marker="*", markersize=15)

plt.show()

輸出

更新於: 08-Jul-2021

3K+ 檢視次數

開啟你的 職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.