本文整理汇总了Python中myquaternaryutility.QuaternaryPlot.rgb_comp方法的典型用法代码示例。如果您正苦于以下问题:Python QuaternaryPlot.rgb_comp方法的具体用法?Python QuaternaryPlot.rgb_comp怎么用?Python QuaternaryPlot.rgb_comp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myquaternaryutility.QuaternaryPlot
的用法示例。
在下文中一共展示了QuaternaryPlot.rgb_comp方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
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
示例2: __init__
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
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)
示例3: __init__
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
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_()
示例4: __init__
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
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)
示例5: plotbinarylines_axandinset
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
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
示例6: plotbinarylines_quat
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
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
示例7: len
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
from myquaternaryutility import QuaternaryPlot
from quaternary_FOM_stackedtern10 import *
ellabels=['Aa', 'Bb', 'Cc', 'Dd']
axl, stpl=make10ternaxes(ellabels=ellabels)
gridi=30
comps_10full=[(a*1./gridi, b*1./gridi, c*1./gridi, (gridi-a-b-c)*1./gridi) for a in numpy.arange(0,1+gridi) for b in numpy.arange(0,1+gridi-a) for c in numpy.arange(0,1+gridi-a-b)]
comps_10full=list(set(comps_10full))
print len(comps_10full)
#plotpoints_cmyk
comps_10full=numpy.array(comps_10full)
pylab.figure()
stpquat=QuaternaryPlot(111, ellabels=ellabels)
cols=stpquat.rgb_comp(comps_10full)
stpquat.scatter(comps_10full, c=cols, s=20, edgecolors='none')
norm=colors.Normalize(vmin=0, vmax=1)
cmap=cm.jet
scatter_10axes(comps_10full, cols, stpl, s=20, edgecolors='none', cb=True, norm=norm, cmap=cmap)
stpquat.label()
pylab.savefig('stackedtern_quat.png')
pylab.figure(axl[0].figure.number)
pylab.savefig('stackedtern.png')
pylab.show()
示例8: len
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
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)
#pylab.subplots_adjust(left=0, right=1, bottom=0, top=1, wspace=0, hspace=0)
示例9:
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
f.close()
dropd['compositions']=numpy.array([dropd[elkey] for elkey in elkeys]).T
pylab.figure()
#axq=pylab.subplot(111)
stpq=QuaternaryPlot(111, ellabels=ellabels)
comps=numpy.array([dropd[elkey] for elkey in elkeys]).T
selectinds, distfromlin, lineparameter=stpq.filterbydistancefromline(comps, compverts[0], compverts[1], critdist, betweenpoints=betweenbool, invlogic=invertbool, returnall=True)
dropd['lineparameter']=lineparameter
dropd['distfromlin']=distfromlin
lineparameter=lineparameter[selectinds]
cols=stpq.rgb_comp(comps[selectinds])
stpq.plotbycolor(comps[selectinds], cols, marker='o', markersize=5, alpha=.6)
stpq.line(compverts[0], compverts[1], lw=2)
#stpq.scatter(comps[selectinds], pointsize
stpq.set_projection(azim=view_azim, elev=view_elev)
stpq.label(fontsize=20)
pylab.savefig(os.path.join(savefolder, 'QuatPoints.png'))
pylab.figure()
for k, v in dropd.iteritems():
# if k in elkeys or k in ellabels or k in ['Sample', 'x(mm)', 'y(mm)', 'compositions']:
# continue
pylab.clf()
示例10:
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
dropd['compositions']=numpy.array([dropd[elkey] for elkey in elkeys]).T
comps=numpy.array([dropd[elkey] for elkey in elkeys]).T
gridi=30
comps30=[(a*1./gridi, b*1./gridi, c*1./gridi, (gridi-a-b-c)*1./gridi) for a in numpy.arange(0,1+gridi) for b in numpy.arange(0,1+gridi-a) for c in numpy.arange(0,1+gridi-a-b)]
pylab.figure()
#axq=pylab.subplot(111)
stpq=QuaternaryPlot(111, ellabels=ellabels)
cols=stpq.rgb_comp(comps30)
stpq.plotbycolor(comps30, cols, marker='o', markersize=3, alpha=1)
stpq.set_projection(azim=view_azim, elev=view_elev)
pylab.savefig(os.path.join(savefolder, 'QuatPointsAll.png'))
pylab.savefig(os.path.join(savefolder, 'QuatPointsAll.eps'))
pylab.figure()
#axq=pylab.subplot(111)
stpqp=QuaternaryPlot(111, ellabels=ellabels)
selectinds, distfromplane, xyparr, xyp_verts,intriangle=stpqp.filterbydistancefromplane(comps, compvertsp[0], compvertsp[1], compvertsp[2], critdistp, withintriangle=betweenbool, invlogic=invertbool, returnall=True)
示例11:
# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import rgb_comp [as 别名]
##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,代码行数:32,代码来源:platemapgenerator_calccompsforsingleplate_sparse+center.py