【发布时间】:2021-11-08 12:15:27
【问题描述】:
我正在使用一个数据集,该数据集在其列中包含逗号分隔的分类响应,并试图绘制一个类似于下面的散点图。我认为正确的方法可能是使用 seaborn swarmplot,例如:ax = sns.swarmplot(x="id", y="family", data=dftest) 但结果与我想要的相差甚远。我正在寻找一些关于如何重建类似情节的指示?
样本数据:
| id | family | city | nation | world |
|---|---|---|---|---|
| 1 | next week, next few years | next week, next few years | lifetime | children's lifetime |
| 2 | next few years, lifetime | children's lifetime | next few years | next week, next few years, children's lifetime |
| 3 | next week, next few years | lifetime | children's lifetime | children's lifetime |
| 4 | next week, next few years | next few years | next week, next few years, lifetime, | next week, next few years, children's lifetime |
| 5 | next few years, lifetime | children's lifetime | children's lifetime | lifetime |
figure source: Meadows, D., Meadows, D., Randers, J. and Behrens, W., 1972. The Limits to growth. A report for the club of Rome's project on the predicament of mankind. 1st ed. New York: Universe Books.
【问题讨论】:
标签: python pandas matplotlib seaborn