本文整理汇总了Python中myquaternaryutility.QuaternaryPlot类的典型用法代码示例。如果您正苦于以下问题:Python QuaternaryPlot类的具体用法?Python QuaternaryPlot怎么用?Python QuaternaryPlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QuaternaryPlot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, previousmm, execute=True, **kwargs):
super(MainMenu, self).__init__(None)
self.ui=plottypeDialog(self, **kwargs)
intervs=20
compsint=[[b, c, (intervs-a-b-c), a] for a in numpy.arange(0,intervs+1)[::-1] for b in numpy.arange(0,intervs+1-a) for c in numpy.arange(0,intervs+1-a-b)][::-1]
print len(compsint)
comps=numpy.float32(compsint)/intervs
pylab.figure()
stpquat=QuaternaryPlot(111)
cols=stpquat.rgb_comp(comps)
self.ui.loadplotdata(comps, cols)
if execute:
self.ui.exec_()
示例2: __init__
class binarylines:
def __init__(self, ax, insetax, ellabels=['A', 'B', 'C', 'D'], offset=0.02, numcomppts=21, view_azim=-159, view_elev=30, **kwargs):
self.ax=ax
self.insetax=insetax
self.ellabels=ellabels
self.stpq=QuaternaryPlot(insetax, ellabels=ellabels, offset=offset)
comppairs=[]
a=numpy.linspace(0, 1, 21)
count=-1
for i in range(4):
for j in range(i+1, 4):
count+=1
b=numpy.zeros((numcomppts, 4), dtype='float64')
b[:, i]=a
b[:, j]=1.-a
comppairs+=[(c1, c2) for c1, c2 in zip(b[:-1], b[1:])]
for (c1, c2) in comppairs:
self.stpq.line(c1, c2, fmt='-', c=self.stpq.rgb_comp([(c1+c2)/2.])[0], **kwargs)
self.stpq.set_projection(azim=view_azim, elev=view_elev)
self.stpq.label()
def plotbinaryfom(self, comps, fom, **kwargs):
cb=comps>.001
ms=['<','>','^','v','s','D']
count=-1
for i in range(4):
for j in range(i+1, 4):
count+=1
k, l=tuple(set(range(4))-set([i, j]))
barr=numpy.array([numpy.logical_not(b[k]|b[l]) for b in cb]) #numpy.logical_xor(b[i], b[j])&
if not numpy.any(barr):
continue
cmps=comps[barr]
inds=numpy.argsort(cmps[:, j])
cmps=cmps[inds]
cols=self.stpq.rgb_comp(cmps)
ys=fom[barr][inds]
for count2, (c, col, y) in enumerate(zip(cmps, cols, ys)):
if count2==len(ys)//2:
self.ax.plot(c[j], y, marker=ms[count], c=col, markeredgecolor=col, label='%s,%s' %(self.ellabels[i], self.ellabels[j]), **kwargs)
else:
self.ax.plot(c[j], y, marker=ms[count], c=col, markeredgecolor=col, **kwargs)
#self.ax.plot(c[j], y, marker=ms[count], c=col, markeredgecolor='None')
for count3, (c1, col1, y1, c2, col2, y2) in enumerate(zip(cmps[:-1], cols[:-1], ys[:-1], cmps[1:], cols[1:], ys[1:])):
col=numpy.array([col1, col2]).mean(axis=0)
self.ax.plot([c1[j], c2[j]], [y1, y2], '-', c=col, **kwargs)
def binarylineslegend(self, **kwargs):
try:
self.ax.legend(**kwargs)
except:
pass
示例3: __init__
def __init__(self, parent=None, title='', folderpath=None):
super(dialog, self).__init__(parent)
plotw=plotwidget(self)
ax=plotw.axes
intervs=20
compsint=[[b, c, (intervs-a-b-c), a] for a in numpy.arange(0,intervs+1)[::-1] for b in numpy.arange(0,intervs+1-a) for c in numpy.arange(0,intervs+1-a-b)][::-1]
print len(compsint)
comps=numpy.float32(compsint)/intervs
pylab.figure()
stpquat=QuaternaryPlot(111)
cols=stpquat.rgb_comp(comps)
stpquat.scatter(comps, c=cols, s=100, edgecolors='none')
stpquat.label()
self.tf=ternaryfaces(ax)
self.tf.label()
self.tf.scatter(comps, cols, skipinds=[0, 1, 2, 3], s='patch')
QObject.connect(plotw, SIGNAL("genericclickonplot"), self.plotclick)
mainlayout=QGridLayout()
mainlayout.addWidget(plotw, 0, 0)
self.setLayout(mainlayout)
示例4: plotbinarylines_quat
def plotbinarylines_quat(ax, comps, fom, ellabels=['A', 'B', 'C', 'D'], legloc=4, **kwargs):
cb=comps>.001
qtemp=QuaternaryPlot(None)
ms=['<','>','^','v','s','D']
# for i in range(4):
# barr=cb[:, i]>.999
# if not numpt.any(barr):
# continue
# ax.plot(c[j], y, ms[count], c=c, ms=ms, markeredgecolor='None', label='%s,%s' %(ellabels[i], ellabels[j]), **kwargs)
count=-1
for i in range(4):
for j in range(i+1, 4):
count+=1
k, l=tuple(set(range(4))-set([i, j]))
barr=numpy.array([numpy.logical_not(b[k]|b[l]) for b in cb]) #numpy.logical_xor(b[i], b[j])&
if not numpy.any(barr):
continue
cmps=comps[barr]
inds=numpy.argsort(cmps[:, j])
cmps=cmps[inds]
cols=qtemp.rgb_comp(cmps)
ys=fom[barr][inds]
for count2, (c, col, y) in enumerate(zip(cmps, cols, ys)):
if count2==len(ys)//2:
ax.plot(c[j], y, marker=ms[count], c=col, markeredgecolor=col, label='%s,%s' %(ellabels[i], ellabels[j]), **kwargs)
else:
ax.plot(c[j], y, marker=ms[count], c=col, markeredgecolor=col, **kwargs)
#ax.plot(c[j], y, marker=ms[count], c=col, markeredgecolor='None')
for count3, (c1, col1, y1, c2, col2, y2) in enumerate(zip(cmps[:-1], cols[:-1], ys[:-1], cmps[1:], cols[1:], ys[1:])):
col=numpy.array([col1, col2]).mean(axis=0)
ax.plot([c1[j], c2[j]], [y1, y2], '-', c=col, **kwargs)
try:
ax.legend(loc=legloc).draggable()
except:
pass
示例5: __init__
def __init__(self, comps, parent=None, title='', folderpath=None):
super(dialog, self).__init__(parent)
plotw=plotwidget(self)
ax=plotw.axes
inds=np.where(comps[:, -1]==0.)[0]
comps=comps[inds, :-1]
#print comps.shape
stpquat=QuaternaryPlot(ax)
ax.cla()
cols=stpquat.rgb_comp(comps)
#stpquat.scatter(comps, c=cols, s=100, edgecolors='none')
#stpquat.label()
self.tf=ternaryfaces_shells(ax, nintervals=intervs)
self.tf.label()
self.tf.scatter(comps, cols, skipinds=[0, 1, 2, 3], s='patch')
#only select comps
plotw2=plotwidget(self, projection3d=True)
ax=plotw2.axes
#unary
stpquat=QuaternaryPlot(ax)
stpquat.scatter(comps, c=cols, s=100, edgecolors='none')
stpquat.label()
QObject.connect(plotw, SIGNAL("genericclickonplot"), self.plotclick)
QObject.connect(plotw2, SIGNAL("genericclickonplot"), self.plotclick)
mainlayout=QGridLayout()
mainlayout.addWidget(plotw, 0, 0)
mainlayout.addWidget(plotw2, 1, 0)
self.setLayout(mainlayout)
示例6: plotbinarylines_axandinset
def plotbinarylines_axandinset(ellabels=['A', 'B', 'C', 'D'], fig=None, mainax=[.3, .12, .6, .83], insetax=[0, .7, .2, .3], numcomppts=21, view_azim=-159, view_elev=30, **kwargs):
if fig is None:
fig=pylab.figure(figsize=(8, 5))
ax=fig.add_axes(mainax)
ax2=fig.add_axes(insetax, projection='3d')
stpq=QuaternaryPlot(ax2, ellabels=ellabels)
comppairs=[]
a=numpy.linspace(0, 1, 21)
count=-1
for i in range(4):
for j in range(i+1, 4):
count+=1
b=numpy.zeros((numcomppts, 4), dtype='float64')
b[:, i]=a
b[:, j]=1.-a
comppairs+=[(c1, c2) for c1, c2 in zip(b[:-1], b[1:])]
for (c1, c2) in comppairs:
stpq.line(c1, c2, fmt='-', c=stpq.rgb_comp([(c1+c2)/2.])[0], **kwargs)
stpq.set_projection(azim=view_azim, elev=view_elev)
stpq.label()
return ax, ax2
示例7:
import pylab, numpy
from myquaternaryutility import QuaternaryPlot
q=QuaternaryPlot(111)
#t=numpy.linspace(0,1.,5)
#comps=[[a,b,c,d] for a in t for b in t for c in t for d in t if a+b+c+d==1.]
#comps=numpy.float32(comps)
t=numpy.linspace(0,1.,30)
comps=[[a,b,1.-a-b-(2.*a**2+b),2.*a**2+b] for a in t for b in t[:10] if a+b+(2.*a**2+b)<=1.]
comps=numpy.float32(comps)
x, y, z=q.toCart(comps)
q.scatter(comps,c=comps[:,3])
#q.ax.scatter(x, y, z, c=z)
q.plotabcprojection(comps, c=(.4, .4, .4))
q.label(ha='center', va='center', fontsize=16)
q.set_projection(azim=-17, elev=-6)
pylab.show()
示例8: QuaternaryPlot
import pylab, numpy
from myquaternaryutility import QuaternaryPlot
q = QuaternaryPlot(211)
q2 = QuaternaryPlot(212)
# t=numpy.linspace(0,1.,5)
# comps=[[a,b,c,d] for a in t for b in t for c in t for d in t if a+b+c+d==1.]
# comps=numpy.float32(comps)
t = numpy.linspace(0, 1.0, 30)
comps = [
[a, b, 1.0 - a - b - (2.0 * a ** 2 + b), 2.0 * a ** 2 + b]
for a in t
for b in t[:10]
if a + b + (2.0 * a ** 2 + b) <= 1.0
]
comps = numpy.float32(comps)
examplenum = 0
if examplenum == 0:
compvert2 = numpy.array([0.125, 0.125, 0.6, 0.15])
compvert0 = numpy.array([0.2, 0.2, 0.0, 0.6])
compvert1 = numpy.array([1.0, 0.0, 0.0, 0])
critdist = 0.04
withintriangle = False
elif examplenum == 1:
compvert2 = numpy.array([0.125, 0.125, 0.6, 0.15])
compvert0 = numpy.array([0.2, 0.2, 0.0, 0.6])
compvert1 = numpy.array([1.0, 0.0, 0.0, 0])
示例9:
if SYSTEM==0:
elkeys=['Ni', 'Fe', 'Co', 'Ce']
pl=[]
pl+=['C:/Users/gregoire/Documents/EchemDropRawData/NiFeCoCe/results/20130402NiFeCoCe_Plate1_5500_dlist.dat']
pl+=['C:/Users/gregoire/Documents/EchemDropRawData/NiFeCoCe/results/20130403NiFeCoCe_Plate2_5498_dlist.dat']
pl+=['C:/Users/gregoire/Documents/EchemDropRawData/NiFeCoCe/results/20130403NiFeCoCe_Plate3_4835_dlist.dat']
compend1=numpy.array([.5, .5, .0, .0])
compend2=numpy.array([.27, 0, .27, .46])
critdist=.06
savep='C:/Users/gregoire/Documents/EchemDropRawData/NiFeCoCe/parsedresults/201304NiFeCoCe_compline%.2f_plate123_dlist.dat' %critdist
savep2='C:/Users/gregoire/Documents/EchemDropRawData/NiFeCoCe/parsedresults/201304NiFeCoCe_compline%.2f_linedetails.dat' %critdist
savep3='C:/Users/gregoire/Documents/EchemDropRawData/NiFeCoCe/parsedresults/201304NiFeCoCe_compline%.2f_samples.txt' %critdist
betweenpoints=False
stpq=QuaternaryPlot(111)
platesdlist=[]
plotcomps=[]
lined={}
lined['distfromlin']=[]
lined['lineparameter']=[]
lined['compend1']=compend1
lined['compend2']=compend2
lined['critdist']=critdist
lined['betweenpoints']=betweenpoints
for p in pl:
f=open(p, mode='r')
dlist=pickle.load(f)
f.close()
comps=numpy.array([d['compositions'] for d in dlist])
示例10: len
from quaternary_faces_shells import ternaryfaces_shells
from myquaternaryutility import QuaternaryPlot
intervs=10
compsint=[[b, c, (intervs-a-b-c), a] for a in numpy.arange(0,intervs+1)[::-1] for b in numpy.arange(0,intervs+1-a) for c in numpy.arange(0,intervs+1-a-b)][::-1]
print len(compsint)
comps=numpy.float32(compsint)/intervs
pylab.figure()
stpquat=QuaternaryPlot(111)
cols=stpquat.rgb_comp(comps)
stpquat.scatter(comps, c=cols, s=1200, edgecolors='none')
stpquat.label()
pylab.figure()
ax=pylab.gca()
tf=ternaryfaces_shells(ax, nintervals=intervs)
tf.label()
#inds_x_y=tf.toCart(comps)
tf.scatter(comps, cols, skipinds=[0, 1, 2, 3], s='patch')
#pylab.figure(figsize=(12, 4))
#tf.quatscatter(comps, cols, s=200, fontsize=0, azim=72, elev=20, edgecolor='none', outline=True)
示例11: QuaternaryPlot
#ax=pylab.subplot(211)
#ax2=pylab.subplot(212)
#pylab.subplots_adjust(left=.03, right=.97, top=.97, bottom=.03, hspace=.01)
ax2=fig.add_subplot(len(dropdl), 1, count+1)
ax2.set_aspect(1)
mapbl=ax2.scatter(x, y, c=fom, s=60, marker='s', edgecolors='none', cmap=cmap, norm=norm)
ax2.set_xlim(x.min()-2, x.max()+2)
ax2.set_ylim(y.min()-2, y.max()+2)
ax2.set_title('plate %d' %(count+1))
#pylab.title('CP1Ess (V) Map')
figquat=pylab.figure(figsize=(8, 8))
stp = QuaternaryPlot(111, minlist=[0., 0., 0., 0.], ellabels=ellabels)
stp.scatter(comp, c=fom, s=pointsize, edgecolors='none', cmap=cmap, norm=norm)
stp.label(ha='center', va='center', fontsize=20)
stp.set_projection(azim=view_azim, elev=view_elev)
caxquat=figquat.add_axes((.83, .3, .04, .4))
cb=pylab.colorbar(stp.mappable, cax=caxquat, extend=extend)
cb.set_label(fomlabel, fontsize=16)
stp.ax.set_title('plate %d' %(count+1))
figquatall+=[figquat]
compsall=numpy.array(compsall)
fomall=numpy.array(fomall)
plateindall=numpy.array(plateindall)
示例12:
##f.close()
#
sys.path.append('C:/Users/Gregoire/Documents/PythonCode/ternaryplot')
from myquaternaryutility import QuaternaryPlot
from quaternary_FOM_stackedtern20 import *
axl, stpl=make20ternaxes()
#
#for d in dlist:
# c=numpy.array([d[el] for el in ['A', 'B', 'C', 'D']])
# if c.sum()>0:
# c/=c.sum()
# d['compositions']=c
#carr=numpy.array([d['compositions'] for d in dlist])
carr=numpy.array(comps)
pylab.figure()
stpq=QuaternaryPlot(111)
#stpq.scatter(carr)
cols=stpq.rgb_comp(carr)
stpq.scatter(carr, c=cols, s=20, edgecolors='none')
scatter_20axes(carr, cols, stpl, s=20, edgecolors='none', cb=False)
stpq.label()
#axl[0].figure.savefig('C:/Users/Gregoire/Documents/CaltechWork/platemaps/nestedtetr/test2.png')
pylab.show()
开发者ID:johnmgregoire,项目名称:JCAPGeneratePrintCode,代码行数:30,代码来源:platemapgenerator_calccompsforsingleplate_sparse+center.py
示例13: enumerate
f=open(newpath, mode='w')
f.write('\n'.join(writelines))
f.close()
sys.path.append('C:/Users/Gregoire/Documents/PythonCode/ternaryplot')
from myquaternaryutility import QuaternaryPlot
from myternaryutility import TernaryPlot
for d in dlist:
c=numpy.array([d[el] for el in ['A', 'B', 'C', 'D']])
if c.sum()>0:
c/=c.sum()
d['compositions']=c
carr=numpy.array([d['compositions'] for d in dlist])
stpq=QuaternaryPlot(111)
stpq.scatter(carr)
pylab.figure()
for count, tv in enumerate(comps_d):
stpq=TernaryPlot((4, 2, count+1))
tvnorm=[tvv/tvv.sum() for tvv in tv]
stpq.scatter(tvnorm, marker='.', c='r', edgecolor='none')
if count<5:
ttt=tc
else:
ttt=tc19
stpq.scatter(ttt, marker='.', c='g', edgecolor='none')
pylab.show()
示例14:
import pylab, numpy
from myquaternaryutility import QuaternaryPlot
q=QuaternaryPlot(211)
q2=QuaternaryPlot(212)
#t=numpy.linspace(0,1.,5)
#comps=[[a,b,c,d] for a in t for b in t for c in t for d in t if a+b+c+d==1.]
#comps=numpy.float32(comps)
t=numpy.linspace(0,1.,30)
comps=[[a,b,1.-a-b-(2.*a**2+b),2.*a**2+b] for a in t for b in t[:10] if a+b+(2.*a**2+b)<=1.]
comps=numpy.float32(comps)
examplenum=1
if examplenum==0:
compend1=numpy.array([.2, .4, .3, .1])
compend2=numpy.array([.2, 0, .2, .6])
critdist=.1
betweenpoints=False
elif examplenum==1:
compend1=numpy.array([0.1, .1, .8, 0])
compend2=numpy.array([.2, .2, 0., .6])
critdist=.05
betweenpoints=False
elif examplenum==2:
compend1=numpy.array([0.125, .125, .6, .15])
compend2=numpy.array([.2, .2, 0., .6])
critdist=.05
示例15: samesside
import pylab, numpy, copy, itertools
from myquaternaryutility import QuaternaryPlot
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
def samesside(p,q,a,b):
cp1=numpy.cross(b-a,p-a)
cp2=numpy.cross(b-a,q-a)
return numpy.dot(cp1,cp2)>0.
def intriangle(p, trianglepoints):
return not (False in [samesside(p,*triperm) for triperm in itertools.permutations(trianglepoints)])
q=QuaternaryPlot(111)
#define these to be modified for each end member
z=numpy.zeros(4, dtype='float64')
ctr3=numpy.ones(4, dtype='float64')/3.
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(4):
a=copy.copy(z)
a[i]=1.
b=copy.copy(ctr3)
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