我有一个数据集,如下所示(在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])
我试图用matplotlib创建三值图,如图(source)所示。轴是A、B、C和D的值,应该用等高线表示,点需要像图中那样标记。
这样的绘图可以在matplotlib中创建还是用Python创建?
你可以试试这样的方法:
请注意,可以通过执行以下操作来移除x、y轴:
不过,对于三角轴+标签和记号,我还不知道,但如果有人有解决方案,我会采取;)
最好的
朱利安
您可以尝试下面的代码,灵感来自: https://matplotlib.org/gallery/images_contours_and_fields/tricontour_smooth_user.html#sphx-glr-gallery-images-contours-and-fields-tricontour-smooth-user-py
ternary plot
是的,他们可以;至少有两个软件包可以提供帮助。
我曾经试着在一篇博客文章中收集它们,Ternary diagrams。一定要看看各种各样的链接和评论。
2019-09-11更新:我写了一篇关于同一主题的更新的、更实用的博客文章:x lines of Python: Ternary diagrams。它使用前面引用的
python-ternary
库。这些似乎是Python的最佳选择:
在另一个SO问题中也有一些建议:Library/tool for drawing ternary/triangle plots [closed]。
相关问题 更多 >
编程相关推荐