用于绘制三元/三角形图的库/工具 [英] Library/tool for drawing ternary/triangle plots

查看:114
本文介绍了用于绘制三元/三角形图的库/工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要绘制表示摩尔分数( x y z )( x + y + z = 1).每个图表示等值物质,例如具有相同熔点的物质.这些图需要在具有不同颜色/符号的同一个三角形上绘制,如果我还可以连接点,那将是很好的.

I need to draw ternary/triangle plots representing mole fractions (x, y, z) of various substances/mixtures (x + y + z = 1). Each plot represents iso-valued substances, e.g. substances which have the same melting point. The plots need to be drawn on the same triangle with different colors/symbols and it would be nice if I could also connect the dots.

我看过matplotlib,R和gnuplot,但是它们似乎无法绘制这种图. R的第三方 ade4 包似乎可以绘制它,但是我不确定是否可以在同一个三角形上绘制多个图.

I have looked at matplotlib, R and gnuplot, but they don't seem to be able to draw this kind of plot. The 3rd party ade4 package for R seems to be able to draw it, but I'm not sure if I can draw multiple plots on the same triangle.

我需要可以在Linux或Windows下运行的软件.我愿意接受任何建议,包括其他语言的库,例如Perl,PHP,Ruby,C#和Java.

I need something that runs under Linux or Windows. I'm open to any suggestions, including libraries for other languages, e.g. Perl, PHP, Ruby, C# and Java.

推荐答案

R有一个名为

R has an external package called VCD which should do what you want.

文档非常好(带有包装的122页手册);包裹的作者(Michael Friendly教授)还有一本同名的书,定量信息的可视显示.

The documentation is very good (122 page manual distributed w/ the package); there's also a book by the same name, Visual Display of Quantitative Information, by the package's author (Prof. Michael Friendly).

要使用 vcd 创建三元图,只需调用 ternaryplot() 并传入mx 3矩阵,即具有三个矩阵列.

To create ternary plots using vcd, just call ternaryplot() and pass in an m x 3 matrix, i.e., a matrix with three columns.

方法签名非常简单;仅需要一个参数(m x 3数据矩阵);并且所有关键字参数都与图的美观有关,除了比例尺(将比例尺设置为1时,该比例尺将按列标准化数据).

The method signature is very simple; only a single parameter (the m x 3 data matrix) is required; and all of the keyword parameters relate to the plot's aesthetics, except for scale, which when set to 1, normalizes the data column-wise.

要在三元图上绘制数据点,将给定点的坐标计算为质点的重心,其中组成数据矩阵的每个特征值都是单独的权重,因此点V(a,b,c)的坐标为

To plot data points on the ternary plot, the coordinates for a given point are calculated as the gravity center of mass points in which each feature value comprising the data matrix is a separate weight, hence the coordinates of a point V(a, b, c) are

V(b, c/2, c * (3^.5)/2

为生成下图,我只是创建了一些假数据来代表四种不同的化学混合物,每种混合物由三种物质(x,y,z)的不同部分组成.我按比例缩放了输入(因此x + y + z = 1),但是如果您传递其"scale"参数的值(实际上,默认值为1,我相信这是您的问题),则该函数将为您完成此操作要求).我使用了不同的颜色符号代表四个数据点,但是您也可以只使用一种颜色/符号并标记每个点(通过'id'参数).

To generate the diagram below, i just created some fake data to represent four different chemical mixtures, each comprised of varying fractions of three substances (x, y, z). I scaled the input (so x + y + z = 1) but the function will do it for you if you pass in a value for its 'scale' parameter (in fact, the default is 1, which i believe is what your question requires). I used different colors & symbols to represent the four data points, but you can also just use a single color/symbol and label each point (via the 'id' argument).

这篇关于用于绘制三元/三角形图的库/工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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