This will create a basic ternary plot (or quaternary, quinternary, etc.) Converts ternary data to normalized for for plotting on the returned axes.
Parameters: |
|
---|---|
Return type: | |
Returns: | A (N,3) shaped numpy.array, coordinates are transformed to triangular axes. |
For example:
from matplotlib.pylab import *
from mango.application.plot import ternaryPlot
k = 0.5
s = 1000
data = vstack((
array([k,0,0]) + rand(s,3),
array([0,k,0]) + rand(s,3),
array([0,0,k]) + rand(s,3)
))
color = array([[1,0,0]]*s + [[0,1,0]]*s + [[0,0,1]]*s)
newdata, ternAx = ternaryPlot(data)
ax, fig = ternAx.createAxes()
ax.scatter(
newdata[:,0],
newdata[:,1],
s=2,
alpha=0.5,
color=color
)
show()