为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

Cats萌萌 2021-12-17 14:41:47
我正在尝试绘制 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)

输出:

//img1.sycdn.imooc.com//61bc31480001e74c03890266.jpg

查看完整回答
反对 回复 2021-12-17
  • 1 回答
  • 0 关注
  • 180 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号