python edgecolor,更改Matplotlib Streamplot箭头的FaceColor和EdgeColor

(请注意,下面的分析可能并不完全正确,我只是粗略地查看了一下来源。)

在创建箭头时,streamplot似乎做了两件事:将箭头面片(类型FancyArrowPatch)添加到轴

向PatchCollection(c.arrows)添加相同的箭头补丁

出于某些原因(我想获得正确的缩放比例是背后的原因),集合似乎没有被使用,也没有添加到轴上。因此,如果更改颜色贴图或集合的颜色,则不会对绘图产生任何影响。在

可能有更漂亮的方法,但是如果你想要,例如,黑色箭头进入你的情节,你可以这样做:import matplotlib.patches

# get the axes (note that you should actually capture this when creating the subplot)

ax = plt.gca()

# iterate through the children of ax

for art in ax.get_children():

# we are only interested in FancyArrowPatches

if not isinstance(art, matplotlib.patches.FancyArrowPatch):

continue

# remove the edge, fill with black

art.set_edgecolor([0, 0, 0, 0])

art.set_facecolor([0, 0, 0, 1])

# make it bigger

art.set_mutation_scale(30)

# move the arrow head to the front

art.set_zorder(10)

这将产生:

a1tUl.png

然后是通常的警告:这是丑陋和脆弱的。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值