使用matplotlib.pyplot.scatter()画散点图API参数

matplotlib API地址:https://matplotlib.org/stable/api/index.html

所有的图样例:https://matplotlib.org/stable/gallery/index.html

教程地址:https://matplotlib.org/stable/tutorials/index.html

pyplot绘制散点图

API地址:https://matplotlib.org/stable/api/pyplot_summary.html

牛逼的画散点图函数:scatter()

 相关参数:

https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html#matplotlib.pyplot.scatter

plt.scatter(x,y,alpha=0.5,marker='形状',c=amps,cmap='tab20b')

有趣的marker参数:

https://matplotlib.org/stable/api/markers_api.html

 漂亮的cmap参数:

plt.scatter(x,y,s=area,alpha=0.5,marker='D',c=amps,cmap='颜色')

颜色图通常根据其功能分为几个类别(参见, 例如[Moreland]):

  1. 顺序:亮度和颜色饱和度的变化逐渐增加,通常使用单一色调;应该用于表示具有排序的信息。
  2. 发散:在不饱和颜色的中间相遇的两种不同颜色的亮度和可能饱和度的变化;当绘制的信息具有临界中间值时,例如地形或数据偏离零时,应使用。
  3. 循环:在中间和开始/结束处相遇的两种不同颜色的亮度变化;应用于在端点处环绕的值,例如相位角、风向或一天中的时间。
  4. 定性:往往是杂色;应该用于表示没有顺序或关系的信息。

Perceptually Uniform Sequential colormaps

Sequential colormaps

Sequential (2) colormaps

Diverging colormaps

Cyclic colormaps

Qualitative colormaps

Miscellaneous colormaps

控制大小的s参数:

area = (30*np.random.rand(len(x)))# 要和x,y坐标保存同样的尺寸
plt.scatter(x,y,s=area,alpha=0.5,marker='D',c=amps,cmap='tab20b')
plt.colorbar()
plt.show()

 

area = (30*np.random.rand(len(x)))*5
plt.scatter(x,y,s=area,alpha=0.5,marker='D',c=amps,cmap='tab20b')
plt.colorbar()
plt.show()

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

语音不识别

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值