Description for ternary plot
Python package
This is the package I used https://github.com/marcharper/python-ternary
The following is the most usefull sample for me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| import ternary import numpy as np import pandas as pd import matplotlib.pyplot as plt import random
cm = plt.cm.get_cmap('viridis')
dat=pd.DataFrame(columns=list('XYZV'))
dat['X']=random.sample(range(45),10) dat['Y']=random.sample(range(45),10) dat['Z']=100-(dat['X']+dat['Y']) dat['V']=10**np.random.randint(0,high=10,size=10)/1e5
scale=100
fig, tax = ternary.figure(scale=scale) fig.set_size_inches(10, 9)
points=dat[['X','Y','Z']].values
minv=np.log10(dat.V.min()) maxv=np.log10(dat.V.max())
tax.scatter(points,s=60,vmin=minv,vmax=maxv,colormap=plt.cm.viridis,colorbar=True,c=np.log10(dat['V'].values),cmap=plt.cm.viridis)
tax.boundary(linewidth=1) tax.gridlines(multiple=10, color="gray") tax.ticks(axis='lbr', linewidth=1, multiple=20) tax.get_axes().axis('off') figure.set_size_inches(10, 10) tax.show()
|
How to read tennary plot
这个才是重头戏
一个简单的理解是,三元图是重心图,离哪个顶点近,哪个占比大。
由点向底边做两条平行线建立小正三角形,将底边分成三段,中间为顶部组所占比例,左段为右侧组比例,右段为左侧组比例。
我录个视频吧
发现自己在中文网站上找不到相关的信息