当前位置: 首页>>代码示例>>Python>>正文


Python QuaternaryPlot.set_projection方法代码示例

本文整理汇总了Python中myquaternaryutility.QuaternaryPlot.set_projection方法的典型用法代码示例。如果您正苦于以下问题:Python QuaternaryPlot.set_projection方法的具体用法?Python QuaternaryPlot.set_projection怎么用?Python QuaternaryPlot.set_projection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在myquaternaryutility.QuaternaryPlot的用法示例。


在下文中一共展示了QuaternaryPlot.set_projection方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: quatplot3D

# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import set_projection [as 别名]
    def quatplot3D(self, quatcomps, c, skipinds=range(4), azim=-60, elev=30, alphaall=.2, alphashell=1., fontsize=14, outline=True,  **kwargs):
        numsubs=int(self.nint//4)+1
        quatcomps=numpy.int32(numpy.round(quatcomps*self.nint))
        for nshell in range(int(self.nint//4)+int(self.nint%4>0)):
            ba=((quatcomps==nshell).sum(axis=1, dtype='int32')>0)&((quatcomps>=nshell).prod(axis=1, dtype='int32')>0)
            shellcomps=quatcomps[ba]
            shellc=c[ba]
            
            q=QuaternaryPlot((1, numsubs, nshell+1), outline=outline)
            if alphaall>0:
                q.plot3D(quatcomps*1./self.nint,c, alpha=alphaall, **kwargs)
            if alphashell>0:
                q.plot3D(shellcomps*1./self.nint,shellc, alpha=alphashell, **kwargs)
            if fontsize>0:
                q.label(ha='center', va='center', fontsize=fontsize)
            q.set_projection(azim=azim, elev=elev)

        if self.nint%4==0: #single point with no frame
            ba=(quatcomps==self.nint//4).prod(axis=1, dtype='int32')>0
            if True in ba:
                shellcomps=quatcomps[ba]#only 1 comp but might be duplicated
                shellc=c[ba]
                q=QuaternaryPlot((1, numsubs, numsubs), outline=outline)
                q.plot3D(quatcomps*1./self.nint,c, alpha=alphaall, **kwargs)
                q.plot3D(shellcomps*1./self.nint,shellc, alpha=alphashell, **kwargs)
                if fontsize>0:
                    q.label(ha='center', va='center', fontsize=fontsize)
                q.set_projection(azim=azim, elev=elev)
开发者ID:helgestein,项目名称:PythonCompositionPlots,代码行数:30,代码来源:quaternary_faces_shells.py

示例2: __init__

# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import set_projection [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
开发者ID:helgestein,项目名称:PythonCompositionPlots,代码行数:57,代码来源:quaternary_binary_lines.py

示例3: plotbinarylines_axandinset

# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import set_projection [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
开发者ID:helgestein,项目名称:PythonCompositionPlots,代码行数:24,代码来源:quaternary_FOM_bintern.py

示例4: len

# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import set_projection [as 别名]
    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])
    critdist = 0.04
    withintriangle = True

q.scatter(comps, c=comps[:, 3])

q.label(ha="center", va="center", fontsize=16)
q.set_projection(azim=-17, elev=-6)

inds, distfromplane, xyparr, xyp_verts, intriangle = q2.filterbydistancefromplane(
    comps, compvert0, compvert1, compvert2, critdist, withintriangle=withintriangle, invlogic=False, returnall=True
)
indsnot = q2.filterbydistancefromplane(
    comps, compvert0, compvert1, compvert2, critdist, withintriangle=withintriangle, invlogic=True
)
print len(inds), " points"
q2.scatter(comps[inds], c=comps[inds, 3])
q2.scatter(comps[indsnot], c="grey", marker=".", s=5)
q2.line(compvert0, compvert1)
q2.line(compvert1, compvert2)
q2.line(compvert2, compvert0)

开发者ID:helgestein,项目名称:PythonCompositionPlots,代码行数:31,代码来源:distfromplane_demo.py

示例5: QuaternaryPlot

# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import set_projection [as 别名]
    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')
    
    comp=numpy.array([[dropd['A'][i], dropd['B'][i], dropd['C'][i], dropd['D'][i]] for i in dropinds])
    
    comp=numpy.array([a/a.sum() for a in comp])
    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=16)

    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))
    compsall+=list(comp)
    fomall+=list(fom)
    figquatall+=[figquat]
    plateindall+=[count]*len(fom)
    
fig.subplots_adjust(left=.05, bottom=.03, top=.96, right=.83, hspace=.14)
cax=fig.add_axes((.85, .3, .04, .4))
cb=pylab.colorbar(mapbl, cax=cax, extend=extend)
cb.set_label(fomlabel, fontsize=20)

compsall=numpy.array(compsall)
开发者ID:johnmgregoire,项目名称:JCAPdatavis,代码行数:33,代码来源:echem_stacked_tern.py

示例6: plot

# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import set_projection [as 别名]

#.........这里部分代码省略.........
        if numpy.any(fom > self.vmax):
            if numpy.any(fom < self.vmin):
                extend = "both"
            else:
                extend = "max"
        elif numpy.any(fom < self.vmin):
            extend = "min"
        else:
            extend = "neither"
        print "extend ", extend

        i = self.ternskipComboBox.currentIndex()
        inds = [j for j in range(4) if j != i][:3]
        terncomps = numpy.array([c[inds] / c[inds].sum() for c in comps])
        reordercomps = comps[:, inds + [i]]
        reorderlabels = [self.ellabels[j] for j in inds + [i]]

        fomselect = fom[self.selectinds]
        compsselect = comps[self.selectinds]
        reordercompsselect = reordercomps[self.selectinds]

        fomlabel = self.dataclass.fomlabel
        self.stackedternplotdict = dict(
            [
                ("comps", reordercomps),
                ("fom", fom),
                ("cmap", cmap),
                ("norm", norm),
                ("ellabels", reorderlabels),
                ("fomlabel", fomlabel),
                ("extend", extend),
            ]
        )
        self.echem30_all.clearandplot(self.stackedternplotdict, cb=True, ellabels=reorderlabels)

        print len(fomselect), " samples selected"

        if len(fomselect) > 0:

            self.stackedternplotdictselect = dict(
                [
                    ("comps", reordercompsselect),
                    ("fom", fomselect),
                    ("cmap", cmap),
                    ("norm", norm),
                    ("ellabels", reorderlabels),
                    ("fomlabel", fomlabel),
                    ("extend", extend),
                ]
            )
            self.echem30_select.clearandplot(self.stackedternplotdictselect, cb=True, ellabels=reorderlabels)

            quat = QuaternaryPlot(self.plotw_quat.axes, ellabels=self.ellabels, offset=0)
            quat.label()
            quat.scatter(
                compsselect, c=fomselect, s=s, cmap=cmap, norm=norm, edgecolor="none"
            )  # vmin=self.vmin, vmax=self.vmax,
            cb = self.plotw_quat.fig.colorbar(
                quat.mappable, cax=self.cbax_quat, extend=extend, format=autocolorbarformat((fom.min(), fom.max()))
            )
            cb.set_label(fomlabel, fontsize=18)
            quat.set_projection(azim=azim, elev=elev)

            if self.calctype == 0:
                quat.line(self.compverts[0], self.compverts[1])
                self.quatcalc.plotfomalonglineparameter(
                    self.plotw_tern.axes,
                    self.lineparameter,
                    fomselect,
                    compend1=self.compverts[0],
                    compend2=self.compverts[1],
                    lineparticks=numpy.linspace(0, 1, 4),
                    ls="none",
                    marker=".",
                )
            elif self.calctype == 1:
                self.quatcalc.plotfominselectedplane(
                    self.plotw_tern.axes,
                    self.xyparr,
                    fomselect,
                    xyp_verts=self.xyp_verts,
                    vertcomps_labels=[self.compverts[0], self.compverts[1], self.compverts[2]],
                    s=20,
                    edgecolor="none",
                    cmap=cmap,
                    norm=norm,
                )
                quat.line(self.compverts[0], self.compverts[1])
                quat.line(self.compverts[0], self.compverts[2])
                quat.line(self.compverts[2], self.compverts[1])

            cb = self.plotw_tern.fig.colorbar(
                quat.mappable, cax=self.cbax_tern, extend=extend, format=autocolorbarformat((fom.min(), fom.max()))
            )
            cb.set_label(fomlabel, fontsize=18)

        self.plotw_quat.axes.mouse_init()
        self.plotw_quat.axes.set_axis_off()
        self.plotw_tern.fig.canvas.draw()
        self.plotw_quat.fig.canvas.draw()
开发者ID:johnmgregoire,项目名称:JCAPdatavis,代码行数:104,代码来源:echem_compslices_ui.py

示例7:

# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import set_projection [as 别名]
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)
xyparr=xyparr[selectinds]

开发者ID:johnmgregoire,项目名称:JCAPdatavis,代码行数:31,代码来源:plot_combinedfom_selectsamples_custom.py


注:本文中的myquaternaryutility.QuaternaryPlot.set_projection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。