【问题标题】:Seaborn lineplot not plotting till the maximum valueSeaborn lineplot 直到最大值才绘制
【发布时间】:2020-07-24 21:31:35
【问题描述】:

我正在尝试绘制一个数据框,其中 x 轴作为月份,y 轴作为交易金额。金额列的最大值约为 8,000。

由于大约有 12,000 条记录,因此每天会有多笔交易。

代码

s = sns.FacetGrid(df_time[df_time['movement']=='credit'],row='month',height=5,aspect=1.8)
s.map(sns.lineplot,'day','amount')
s.fig.subplots_adjust(top=0.95)
s.fig.suptitle('Transaction amount(credit) with respect to day and month of the year', fontsize=16)
plt.show()

检查数据框中金额的最大值

df_time[df_time['movement']=='credit'].amount.max()

输出:8835.98

这是我用 seaborn lineplot 得到的情节。

我感到困惑的是,该图应该上升到 8,000 左右,因为这是我的数据框中的最大交易价值,但它只上升到 4,000 并且给了我一个坚实的图和阴影地区。

单图上的这两种形式的图表示什么?

【问题讨论】:

  • 请提供您的代码。在没有看到它的情况下帮助您有点困难(以及您的数据样本)
  • 用更多信息编辑了问题

标签: python dataframe matplotlib seaborn


【解决方案1】:

根据定义,Seaborn 的线图不会绘制最大值。该值本身是同一 x 值(例如平均值)中所有 y 值的聚合。我猜你问的是线路周围“更亮”的区域。

这称为置信区间。它有一个mathematical definition 和一种计算它的方法。 这不是最大值和最小值。因此,无论如何它都不应该绘制最大值。

【讨论】:

    猜你喜欢
    • 2020-05-31
    • 2023-01-17
    • 1970-01-01
    • 2020-08-22
    • 2022-01-25
    • 2020-11-21
    • 2019-04-09
    • 1970-01-01
    相关资源
    最近更新 更多