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


Python QuaternaryPlot.toComp方法代码示例

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


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

示例1: boundaries

# 需要导入模块: from myquaternaryutility import QuaternaryPlot [as 别名]
# 或者: from myquaternaryutility.QuaternaryPlot import toComp [as 别名]
    a[i]=1.
    q.line(a, phcomp, fmt='r-')

# iterate over all 4 phase field triangular boundaries (triangle defined by 3 points, the phase p0 and 2 end members p1,p2) and all 4 composition lines. find intersections
p0=numpy.array(q.toCart([phcomp])).T[0]
xyz_intr_dlist=[]
for countends, (p1, p2) in enumerate(itertools.combinations(xyz_endmembers, 2)):
    for countlines, (l0, l1) in enumerate(xyz_lineendpairs):
        t = numpy.cross(p1-p0, p2 - p0)
        #this is where the line intersects the plane, although it may not be within the triangle
        xyz_intr= l0 + (numpy.dot(t, p0 - l0) / numpy.dot(t, l1 - l0)) * (l1 - l0)
        #check within triangle phase field boundary and if so draw a green dot at itnersection and a translucent triangle
        xyz_triverts=numpy.array([p0, p1, p2])
        if intriangle(xyz_intr,xyz_triverts):
            xyz_intr_dlist+=[dict({}, xyz_intr=xyz_intr, xyz_triverts=xyz_triverts, xyz_lineends=(l0, l1), index_endmems=countends, index_lineends=countlines)]
            q.scatter(q.toComp([xyz_intr]), c='g', s=20)

            verts = [[p0, p1, p2]]

            collection = Poly3DCollection(verts, linewidths=0, alpha=0.2)
            face_color = [0.5, 0.5, 0.5] 
            collection.set_facecolor(face_color)
            q.ax.add_collection3d(collection)

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



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


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