【发布时间】:2022-11-01 18:44:30
【问题描述】:
我正在尝试使用 mpltern 库创建三元散点图。reference
import matplotlib.pyplot as plt
from mpltern.ternary.datasets import get_scatter_points
ax = plt.subplot(projection='ternary')
for seed in [1, 9, 6, 8]:
ax.scatter(*get_scatter_points(11, seed=seed), alpha=0.5, label=seed)
ax.legend()
plt.show()
坚持如何在熊猫数据框中为“分析类型-微生物污染”、“分析类型-其他污染”、“分析类型-组成”列执行相同操作
根据库的 get_scatter_points 函数
def get_scatter_points(n=201, seed=19680801):
np.random.seed(seed)
t = np.random.rand(n)
l = np.random.rand(n)
r = np.random.rand(n)
s = (t + l + r)
t /= s
l /= s
r /= s
return t, l, r
【问题讨论】:
标签: python pandas matplotlib visualization