【问题标题】:How to change marker fillstyle in seaborn lmplot?如何更改 seaborn lmplot 中的标记填充样式?
【发布时间】:2016-08-10 22:11:30
【问题描述】:

是否可以更改 seaborn lmplot 中散点图标记的填充样式?

我试过了:`

sns.lmplot(x=x, 
           y=y, 
           hue=hue, 
           hue_order = hue_order,
           markers=markers,
           scatter_kws = {'fillstyle':'none'})

但我得到了错误:

AttributeError: Unknown property fillstyle

lmplot scatter_kws 参数真的不支持 fillstyle,还是我做错了什么?

【问题讨论】:

  • 标记只是位图;它们通常不会被绘制为多边形
  • @MarcusMüller 你能详细说明一下吗?我的理解是标记是矢量绘制的,就像任何其他绘图元素一样。不是这样吗?如果它们是位图,为什么这会阻止它们在这里填充?如果我只是在做mpl.scatter(),我可以使用fillstyle='none',是吗?
  • 不,你不能。标记只是从掩码中以像素为单位复制的。
  • 如果我只是在做 mpl.scatter(),我可以使用 fillstyle='none',是吗? 我不认为你可以。测试一下。
  • 另外,你可能想要的是{'markerfacecolor': 'none'}

标签: python matplotlib plot seaborn


【解决方案1】:

您不能将'fillstyle':'none' 用作scatter_kw 参数,但您可以使用'facecolors' 完成您想要做的事情。

sns.lmplot(x=x, 
           y=y, 
           hue=hue, 
           hue_order = hue_order,
           markers=markers,
           scatter_kws = {'facecolors':'none'})

有关详细信息,请参阅 matplotlib.pyplot.scatter 文档。

【讨论】:

    猜你喜欢
    • 2016-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-28
    • 2019-05-07
    • 1970-01-01
    • 2021-12-22
    • 2020-11-09
    相关资源
    最近更新 更多