我做了一个情节,看起来像这样
我想找到每个箱子的活动与非活动百分比。我希望y轴为100%,对于每个箱子,该箱子的活动和非活动患者百分比是多少
这是我用来获取此图的代码:
sns.distplot(inactive['inactivity_percentage'], kde = False, label="inactive")
plt.legend(labels=['active','inactive'])
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
plt.show()
我试图计算数据本身的百分比,但由于它是一个连续变量,我无法使图表看起来正确。在现有图表中,我可以得到每个箱子的百分比吗
使用^{} 计算具有相同网格间距的活动和非活动的计数。然后计算每个箱子中的比率,并使用条形图绘制
相关问题 更多 >
编程相关推荐