python - 在 Seaborn 中制作两个相邻的 BoxPlot
问题描述
我有两个清单:
true = [1,3,5,6,2,5,11,2,4,7,8,9,5,8,13]
fake = [5,3,8,7,5,3,13,8,9,13,15,11,8,9,19]
我想将其绘制Seaborn
为boxplot
,并用两种不同的颜色彼此相邻,红色为假货,蓝色为真货。另外,我想要垂直箱线图:
sns.boxplot(x = "true", y = true, color = "blue")
sns.boxplot(y = "fake", y = fake, color = "fake")
plt.show()
解决方案
堆叠在同一轴上:
fig,ax = plt.subplots(1)
sns.boxplot(data=true, color = "blue",ax=ax)
sns.boxplot(data=fake, color = "red",ax=ax)
plt.show()
推荐阅读
- c# - 将 JSON 加载到 WPF 列表框中
- reactjs - ReactJS - 在不重新渲染的情况下切换可见性
- sql - java spring H2合并sql语法错误
- java - 跟踪用户 JAVA 的得分(胜利/失败)并将其注册到文本文件中
- javascript - 将多个输入保存到 localStorage
- apache-spark - 结构化流 - 窗口功能 - 总是选择最新的窗口
- python - 如何从同名包中导入单个函数
- node.js - 将 Node.js 核心网络服务器替换为 Vert.x TCP 服务器
- python - Python将多个行数组放入一行
- python - Python asyncio:阻塞和竞争条件