Seaborn violinplot 中的最小和最大值无效。

huangapple go评论117阅读模式
英文:

Min and max values in seaborn violinplot are invalid

问题

I'm plotting the distribution of daily returns from a stock index in a particular year using seaborn violinplot. However, some extreme values on the chart appear to be plotted improperly.

下面的图表是一年的示例。如您所见,'Piątek' 的最低值约为 -6。

我正在使用 seaborn 的 violinplot 函数绘制如下的数据:

  1. sns.violinplot(x=wig20.iloc[1500:1751,3], y=wig20.iloc[1500:1751,2], width=1, order=['Poniedziałek','Wtorek','Środa','Czwartek','Piątek'])

数据如下所示:

  1. wig20.iloc[1500:1751,0:4].head()
  2. Date wig20 [%] weekday
  3. 1500 2016-01-04 1804.42 -2.943818 Poniedziałek
  4. 1501 2016-01-05 1792.01 -0.687756 Wtorek
  5. 1502 2016-01-07 1745.46 -2.597642 Czwartek
  6. 1503 2016-01-08 1725.14 -1.164163 Piątek
  7. 1504 2016-01-11 1703.78 -1.238160 Poniedziałek

然而,当我检查数据时,我发现最低值为:

  1. wig20.iloc[1500:1751,2].min()
  2. -4.533610974747937

因此,图表完全误导。在上述图表中,'Piątek' 的最低值明显低于 -5。我检查了不同年份的数据,似乎每个大于 4 的最大/最小值都接近图表上的 6,但我不知道为什么会这样。

英文:

I'm plotting the distribution of daily returns from stock index in a particular year using seaborn violinplot. However some extreme values on the chart looks to be plotted improperly.

The chart below is an example for one year. As you can see the lowest value for 'Piątek' is something near -6.

  1. sns.violinplot( x=wig20.iloc[1500:1751,3], y=wig20.iloc[1500:1751,2], width=1, order=['Poniedziałek','Wtorek',&#39roda','Czwartek','Piątek'])

Seaborn violinplot 中的最小和最大值无效。

Data looks like:

  1. wig20.iloc[1500:1751,0:4].head()
  2. Date wig20 [%] weekday
  3. 1500 2016-01-04 1804.42 -2.943818 Poniedziałek
  4. 1501 2016-01-05 1792.01 -0.687756 Wtorek
  5. 1502 2016-01-07 1745.46 -2.597642 Czwartek
  6. 1503 2016-01-08 1725.14 -1.164163 Piątek
  7. 1504 2016-01-11 1703.78 -1.238160 Poniedziałek

However when i checked the data i can see

  1. wig20.iloc[1500:1751,2].min()
  2. -4.533610974747937

So the chart is completely missleading. On the chart above the low for 'Piątek' is definitely below -5. I checked diffrent years and it seems that every max/min value of more than 4 is near the 6 on the chart and i have no clue why it is that way.

答案1

得分: 5

你可以将 cut=0 传递给 sns.violinplot,以在小提琴图上剪切到最小和最大值。

英文:

You can pass cut=0 to sns.violinplot to cut the violin plot at the minimum and maximum values.

huangapple
  • 本文由 发表于 2020年1月7日 02:02:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/59616828.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定