如何将“markersize”参数添加到 DataFrame 图中?

我正在尝试绘制 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),所以我不确定问题是什么。


Cats萌萌
浏览 181回答 1
1回答

qq_花开花谢_0

使用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 pdimport matplotlib.pyplot as pltimport seaborn as snsdf = sns.load_dataset('iris')ax = df.plot(kind='scatter', x='petal_width', y='sepal_width', s=10.0)输出:
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python