q=TernaryPlot(111)


#define these to be modified for each end member
z=numpy.zeros(3, dtype='float64')
ctr2=numpy.ones(3, dtype='float64')/2.
endmembers=[]
lineendpairs=[]
#iterate over 4 end members and draw a line from there to center of opposing face, e.g. (0,.33,.33,.33)
for i in range(3):
    a=copy.copy(z)
    a[i]=1.
    b=copy.copy(ctr2)
    b[i]=0.
    q.line(a, b, fmt='b-')
    q.scatter([b], c='b', s=15)
    endmembers+=[a]
    lineendpairs+=[[a, b]]
#convert the end members and pairs of endpts to cartesian
xy_lineendpairs=[numpy.array(q.toCart(ls)).T for ls in lineendpairs]
xy_endmembers=numpy.array(q.toCart(endmembers)).T

#choose the composition of a phase and draw the trivial phase field lines
phcomp=numpy.array([.5, .3, .2])
q.scatter([phcomp], c='r', s=20)
for i in range(3):
    a=copy.copy(z)
    a[i]=1.
    q.line(a, phcomp, fmt='r-')
Ejemplo n.º 2
0

q = TernaryPlot(111)

#define these to be modified for each end member
z = numpy.zeros(3, dtype='float64')
ctr2 = numpy.ones(3, dtype='float64') / 2.
endmembers = []
lineendpairs = []
#iterate over 4 end members and draw a line from there to center of opposing face, e.g. (0,.33,.33,.33)
for i in range(3):
    a = copy.copy(z)
    a[i] = 1.
    b = copy.copy(ctr2)
    b[i] = 0.
    q.line(a, b, fmt='b-')
    q.scatter([b], c='b', s=15)
    endmembers += [a]
    lineendpairs += [[a, b]]
#convert the end members and pairs of endpts to cartesian
xy_lineendpairs = [numpy.array(q.toCart(ls)).T for ls in lineendpairs]
xy_endmembers = numpy.array(q.toCart(endmembers)).T

#choose the composition of a phase and draw the trivial phase field lines
phcomp = numpy.array([.5, .3, .2])
q.scatter([phcomp], c='r', s=20)
for i in range(3):
    a = copy.copy(z)
    a[i] = 1.
    q.line(a, phcomp, fmt='r-')