【问题标题】:How to plot a cumulative distribution that is unfilled with full alpha?如何绘制未填充完整 alpha 的累积分布?
【发布时间】:2018-11-16 00:14:37
【问题描述】:

我有 2 个 pandas 数据框,我试图在同一个图上绘制它们的累积分布。我更喜欢使用histype=step 获得的未填充样式,但由于某种原因,alpha 非常低,我似乎无法弄清楚如何解决它。

a.hist(cumulative=True, density=True, bins=100, alpha=1, histtype='step')
b.hist(cumulative=True, density=True, bins=100, alpha=1, histtype='step')

将 alpha 设置为低于 1.0(例如 0.5)会使绘图更加难以阅读

如果我使用 stepfilled 样式,alpha 参数似乎可以按预期工作。

a.hist(cumulative=True, density=True, bins=100, alpha=1, histtype='stepfilled')
b.hist(cumulative=True, density=True, bins=100, alpha=1, histtype='stepfilled')

我正在使用 seaborn 和 pandas 以防万一。任何人都知道是什么导致了这种奇怪的行为或如何解决它?

【问题讨论】:

  • 我发现问题出在 seaborn 上。我在某个时候运行了sns.set_style('white'),不知何故导致了这种行为。

标签: python pandas matplotlib seaborn


【解决方案1】:

我发现这是使用 seaborn set_style 的奇怪副作用,我只能通过运行 seaborn 的 reset_orig 函数来修复它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-20
    • 1970-01-01
    • 2021-02-11
    • 2020-11-17
    • 1970-01-01
    • 2016-08-03
    • 2014-07-23
    相关资源
    最近更新 更多