【问题标题】:Unexpected line in the seaborn bar plot [closed]seaborn条形图中的意外线[关闭]
【发布时间】:2020-12-23 10:47:41
【问题描述】:
stars = [9.7, 9.7, 9.5, 9.5, 9.4, 9.3, 9.3, 9.3, 9.2, 9.2]
episodes = ['The Last One',
 'The One Where Everybody Finds Out',
 'The Last One',
 'The One with the Embryos',
 'The One with the Prom Video',
 'The One with the Rumor',
 'The One with the Proposal',
 'The One with the Videotape',
 "The One with Monica and Chandler's Wedding: Part 2",
 "The One with Ross's Wedding"]

sns.barplot(stars, episodes, palette='inferno')
plt.xlabel('Stars') 
plt.ylabel('Episodes') 
plt.title('Top 10 Episodes according to Stars')
plt.xlim(9,10)
plt.show()

你好开发者,请帮助我! 为什么我在第一个小节中得到一条意外的线?

【问题讨论】:

  • 您有两个同名的条目。 Seaborn 然后显示他们的平均值和一个错误栏。如果你真的想要最后两个条目,你可以在其中一个上添加一个额外的空格。
  • 明白了,我没有在数据中注意到这一点。

标签: python matplotlib bar-chart seaborn visualization


【解决方案1】:

第一个栏中的行是因为情节列表中有两个元素的值为最后一个。

【讨论】:

  • 谢谢,在我更改了它们的值后它起作用了。
猜你喜欢
  • 2017-02-26
  • 2021-03-21
  • 1970-01-01
  • 1970-01-01
  • 2015-12-08
  • 1970-01-01
  • 2017-11-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多