【问题标题】:Seaborn stripplot doesn't show the facecolor with only 3 recordsSeaborn stripplot 不显示只有 3 条记录的 facecolor
【发布时间】:2015-11-10 08:07:08
【问题描述】:

说明:

我正在使用 hue 参数使用 stripplot 方法制作绘图,但结果图像的某些标记没有我想要的面部颜色,而是黑色、灰色或白色。

在我的例子中,下面的简化代码使图像相似。只有 3 条记录要绘制,它们的标记会失去面部颜色。

我是 Python 新手,所以我可能会遗漏一些东西...如果这篇文章需要更多信息,请告诉我。

问题:

是否有任何解决方法可以解决仅有的 3 条记录具有面部颜色?

环境:

  • MacOS 10.11.1

  • Python 2.7.10(自制安装)

  • seaborn 0.6.0(pip 安装)

  • matplotlib 1.5.0(pip 安装)

代码:

#!/usr/bin/env python

import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns

data = sns.load_dataset("tips")
data = data[data.sex == "Female"][0:3]

plot = sns.stripplot(
    x="total_bill",
    y="sex", 
    data=data
    )

plt.show()

【问题讨论】:

  • 这对我来说似乎是一个错误......除非我缺少一些隐藏的功能
  • 感谢汤姆嵌入图片。谢谢 mwaskom,我按照这个解决方法。

标签: python matplotlib seaborn


【解决方案1】:

这个问题已经在 GitHub 上提到了。

github.com/mwaskom/seaborn/issues/753

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-11
    • 1970-01-01
    • 2016-10-22
    相关资源
    最近更新 更多