我正在嘗試繪制 DataFrame 并且我想修改標記大小,但似乎我無法在同一個 plot() 調用中執行此操作。ax0 = df_can_t.plot(kind='scatter', x='Year', y='China', \
figsize=(30,10), color = 'red', marker= '+', markersize = 14.0)我收到錯誤:AttributeError:未知屬性標記大小。但是,似乎允許使用“標記大小”(https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html),所以我不確定問題是什么。
1 回答

qq_花開花謝_0
TA貢獻1835條經驗 獲得超7個贊
使用scatter plot,您的大小參數只是s,請嘗試:
ax0 = df_can_t.plot(kind='scatter', x='Year', y='China', \
figsize=(30,10), color = 'red', marker= '+', s = 14.0)
這是一個MVCE:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = sns.load_dataset('iris')
ax = df.plot(kind='scatter', x='petal_width', y='sepal_width', s=10.0)
輸出:
添加回答
舉報
0/150
提交
取消