用于容器的matplotlib符号

2024-09-30 18:31:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我不知道它的名字(有人知道它叫什么吗?)enter image description herehttps://www.marinetraffic.com/img/shipicons/blue1_85.png

为了便于参考,这是取自https://www.marinetraffic.com/en/ais/home/centerx:-12.0/centery:24.9/zoom:4

我相信这就是当前的符号列表https://matplotlib.org/3.1.1/api/markers_api.html

编辑:这里是由下面的代码创建的标记。谢谢@ted930511

编辑2:使用vertices = [(0, 0), (-1, 1), (1, 1), (4, 0), (1, -1), (-1, -1), (0, 0)]稍微更新的版本

enter image description here


Tags: httpscomapi编辑homeimgpngwww
1条回答
网友
1楼 · 发布于 2024-09-30 18:31:40

您可以使用Path创建自定义标记。详情见here

from matplotlib.path import Path
vertices = [(0, 0), (-1, 1), (1, 1), (2, 0), (1, -1), (-1, -1), (0, 0)]
p = Path(vertices,[1,2,2,2,2,2,79])

x = range(10)
y = x

plt.scatter(x, y, marker=p, s=300)

enter image description here

相关问题 更多 >