Seaborn 箱线图显示破折号而不是数据
Seaborn Boxplot showing dashes rather than data
我一直在使用 Seaborn 创建箱线图,但它返回的图表仅显示破折号而不是当前数据。如果有人可以提供任何建议,将不胜感激。
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
UserCount = list([407, 298, 252, 338, 174, 133, 1816, 1880, 1745, 7684, 4993, 4366, 1439, 1418, 1126, 2286, 2411, 1969, 774, 739, 649])
Function = list(["Country Risk", "Country Risk","Country Risk", "News", "News", "News", "Search", "Search", "Search", "Entity Page", "Entity Page", "Entity Page", "Corporate Hierarchy", "Corporate Hierarchy", "Corporate Hierarchy", "Financials", "Financials", "Financials","Portfolio", "Portfolio", "Portfolio"])
Month = list(["October", "November", "December", "October", "November", "December", "October", "November", "December", "October", "November", "December", "October", "November", "December", "October", "November", "December", "October", "November", "December",])
#Created dataframe combining three lists together
TotalUsers = pd.DataFrame({"FC Function": Function, "Month": Month, "User Count": UserCount})
# Draw a nested boxplot to show user count by month
sns.set(style="ticks")
sns.boxplot(x='Month', y= 'User Count', data=TotalUsers, hue="FC Function", palette="PRGn")
sns.despine(offset=10, trim=True)
plt.show()
箱形图 "shows the distribution of quantitative data",但您对 x='Month', y= 'User Count', hue="FC Function"
的分组对应于 TotalUsers
中的单个数据点。单点数据没有分布所以没有画框
我一直在使用 Seaborn 创建箱线图,但它返回的图表仅显示破折号而不是当前数据。如果有人可以提供任何建议,将不胜感激。
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
UserCount = list([407, 298, 252, 338, 174, 133, 1816, 1880, 1745, 7684, 4993, 4366, 1439, 1418, 1126, 2286, 2411, 1969, 774, 739, 649])
Function = list(["Country Risk", "Country Risk","Country Risk", "News", "News", "News", "Search", "Search", "Search", "Entity Page", "Entity Page", "Entity Page", "Corporate Hierarchy", "Corporate Hierarchy", "Corporate Hierarchy", "Financials", "Financials", "Financials","Portfolio", "Portfolio", "Portfolio"])
Month = list(["October", "November", "December", "October", "November", "December", "October", "November", "December", "October", "November", "December", "October", "November", "December", "October", "November", "December", "October", "November", "December",])
#Created dataframe combining three lists together
TotalUsers = pd.DataFrame({"FC Function": Function, "Month": Month, "User Count": UserCount})
# Draw a nested boxplot to show user count by month
sns.set(style="ticks")
sns.boxplot(x='Month', y= 'User Count', data=TotalUsers, hue="FC Function", palette="PRGn")
sns.despine(offset=10, trim=True)
plt.show()
箱形图 "shows the distribution of quantitative data",但您对 x='Month', y= 'User Count', hue="FC Function"
的分组对应于 TotalUsers
中的单个数据点。单点数据没有分布所以没有画框