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


Python Graphics._extra_kwds['aspect_ratio']方法代码示例

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


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

示例1: plot3d

# 需要导入模块: from sage.plot.graphics import Graphics [as 别名]
# 或者: from sage.plot.graphics.Graphics import _extra_kwds['aspect_ratio'] [as 别名]
    def plot3d(self,depth=None):
        # FIXME: refactor this before publishing
        from sage.plot.graphics import Graphics
        from sage.plot.point import point
        from sage.misc.flatten import flatten
        from sage.plot.plot3d.shapes2 import sphere
        if self._n !=3:
            raise ValueError("Can only 3d plot fans.")
        if depth == None:
            depth = self._depth
        if not self.is_finite() and depth==infinity:
            raise ValueError("For infinite algebras you must specify the depth.")

        colors = dict([(0,'red'),(1,'green'),(2,'blue'),(3,'cyan')])
        G = Graphics()

        roots = self.d_vectors(depth=depth)
        compatible = []
        while roots:
            x = roots.pop()
            for y in roots:
                if self.compatibility_degree(x,y) == 0:
                    compatible.append((x,y))
        for (u,v) in compatible:
            G += _arc3d((_normalize(vector(u)),_normalize(vector(v))),thickness=0.5,color='black')

        for i in range(3):
            orbit = self.ith_orbit(i,depth=depth)
            for j in orbit:
                G += point(_normalize(vector(orbit[j])),color=colors[i],size=10,zorder=len(G.all))

        if self.is_affine():
            tube_vectors=map(vector,flatten(self.affine_tubes()))
            tube_vectors=map(_normalize,tube_vectors)
            for v in tube_vectors:
                G += point(v,color=colors[3],size=10,zorder=len(G.all))
            G += _arc3d((tube_vectors[0],tube_vectors[1]),thickness=5,color='gray',zorder=0)
        
        G += sphere((0,0,0),opacity=0.1,zorder=0)
        G._extra_kwds['frame']=False
        G._extra_kwds['aspect_ratio']=1 
        return G
开发者ID:Etn40ff,项目名称:level_zero,代码行数:44,代码来源:tropical_cluster_algebra.py


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