如何在Python中创建三元轮廓图? [英] How to create ternary contour plot in Python?

查看:563
本文介绍了如何在Python中创建三元轮廓图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据集,如下所示(在Python中):

  import numpy as np 
A = np 。阵列([0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0,0.1,0.2,0.3,0.4,0.2,0.2,0.05,0.1])$ ​​b $ b B = np.array ([0.9,0.7,0.5,0.3,0.1,0.2,0.1,0.15,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9])
C = np.array([ 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,0,1,2])

我试图用matplotlib创建三元图,如图所示( 。请务必查看各种链接和评论。



这些似乎是Python的最佳选择:




  • Marc Harper的< a href =https://github.com/marcharper/python-ternary =nofollow noreferrer> python-ternary

  • Veusz ,一个Python绘图库



在另一个SO问题中也有一些建议: 用于绘制三元/三角形图的库/工具[关闭]

I have a data set as follows (in Python):

import numpy as np
A = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0, 0.1, 0.2, 0.3, 0.4, 0.2, 0.2, 0.05, 0.1])
B = np.array([0.9, 0.7, 0.5, 0.3, 0.1, 0.2, 0.1, 0.15, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
C = np.array([0, 0.1, 0.2, 0.3, 0.4, 0.2, 0.2, 0.05, 0.1, 0.9, 0.7, 0.5, 0.3, 0.1, 0.2, 0.1, 0.15, 0])
D = np.array([1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2])

I am trying to create ternary plots with matplotlib as shown in the figure (source). The axes are A, B, C and D values should be denoted by contours and the points need to be labelled like in figure.

Can such plots be created in matplotlib or with Python?

解决方案

Yes they can; there are at least a couple of packages to help.

I once tried to gather them all in a blog post, Ternary diagrams. Be sure to look at the various links and comments too.

These seem to be the best options for Python:

There are also some suggestions in another SO question: Library/tool for drawing ternary/triangle plots [closed].

这篇关于如何在Python中创建三元轮廓图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆