我有以下的df,
df = pd.DataFrame({
"R" : [1, 1, 3, 1, 1, 3, 3, 2, 1, 1],
"F" : [1, 1, 2, 1, 1, 3, 3, 2, 3, 2],
"M" : [1, 2, 3, 1, 2, 3, 3, 2, 4, 4]
})
我没有机会用python创建类似于下面示例的东西。正如您可能注意到的,它显示了上面数据帧的所有可能组合;请注意三个轴:
有谁熟悉如何使用seaborn、matplotlib等来做这件事吗?
发布于 2020-10-29 18:01:53
如果我没记错的话,这是sns.countplot
和sns.FacetGrid
np.random.seed(42)
df = pd.DataFrame(np.random.randint(1,6, size=(100,3)), columns=['R','F','M'])
g = sns.FacetGrid(df, row='R', col='F', )
g.map(sns.countplot, 'M', order=[1,2,3,4,5])
输出:
https://stackoverflow.com/questions/64595585
复制