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


Python Path.unit_circle方法代码示例

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


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

示例1: _slot_path

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
def _slot_path():
    # Returns a Path for a filled unit circle with a vertical rectangle removed.
    circle = Path.unit_circle()
    vertical_bar = _vertical_bar_path()
    vertices = np.concatenate([circle.vertices[:-1], vertical_bar.vertices[-2::-1]])
    codes = np.concatenate([circle.codes[:-1], vertical_bar.codes[:-1]])
    return Path(vertices, codes)
开发者ID:smbz,项目名称:iris,代码行数:9,代码来源:symbols.py

示例2: test_readonly_path

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
def test_readonly_path():
    path = Path.unit_circle()

    def modify_vertices():
        path.vertices = path.vertices * 2.0

    assert_raises(AttributeError, modify_vertices)
开发者ID:aseagram,项目名称:matplotlib,代码行数:9,代码来源:test_path.py

示例3: __init__

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
    def __init__(self, xy, width, height, angle=0.0, **kwargs):
        """
        *xy*
          center of ellipse

        *width*
          length of horizontal axis

        *height*
          length of vertical axis

        *angle*
          rotation in degrees (anti-clockwise)

        Valid kwargs are:
        %(Patch)s
        """
        Patch.__init__(self, **kwargs)

        self.center = xy
        self.width, self.height = width, height
        self.angle = angle
        self._path = Path.unit_circle()
        self._patch_transform = transforms.IdentityTransform()
        self._recompute_transform()
开发者ID:Einstein-NTE,项目名称:einstein,代码行数:27,代码来源:patches.py

示例4: __init__

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
        def __init__(self, xy, width, height, scale=1.0, angle=0.0, **kwargs):
            """
            *xy*
              center of ellipse

            *width*
              total length (diameter) of horizontal axis

            *height*
              total length (diameter) of vertical axis

            *angle*
              rotation in degrees (anti-clockwise)

            Valid kwargs are:
            %(Patch)s
            """
            patches.Patch.__init__(self, **kwargs)

            self.center = xy
            self.width, self.height = width, height
            self.scale = scale
            self.angle = angle
            self._path = Path.unit_circle()
            # Note: This cannot be calculated until this is added to an Axes
            self._patch_transform = transforms.IdentityTransform()
开发者ID:maartenbreddels,项目名称:vaex,代码行数:28,代码来源:tensor.py

示例5: test_contains_points_negative_radius

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
def test_contains_points_negative_radius():
    path = Path.unit_circle()

    points = [(0.0, 0.0), (1.25, 0.0), (0.9, 0.9)]
    expected = [True, False, False]

    assert np.all(path.contains_points(points, radius=-0.5) == expected)
开发者ID:Orpin,项目名称:matplotlib,代码行数:9,代码来源:test_path.py

示例6: test_readonly_path

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
def test_readonly_path():
    path = Path.unit_circle()

    def modify_vertices():
        path.vertices = path.vertices * 2.0

    with pytest.raises(AttributeError):
        modify_vertices()
开发者ID:DanHickstein,项目名称:matplotlib,代码行数:10,代码来源:test_path.py

示例7: _ring_path

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
def _ring_path():
    # Returns a Path for a hollow ring.
    # The outer radius is 1, the inner radius is 1 - _THICKNESS.
    circle = Path.unit_circle()
    inner_radius = 1.0 - _THICKNESS
    vertices = np.concatenate([circle.vertices[:-1], circle.vertices[-2::-1] * inner_radius])
    codes = np.concatenate([circle.codes[:-1], circle.codes[:-1]])
    return Path(vertices, codes)
开发者ID:smbz,项目名称:iris,代码行数:10,代码来源:symbols.py

示例8: epilog

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
def epilog(k1, k2):
    marker = Path.unit_circle()
    for d in _epilog.values():
        plot(d['coords'][columns[k1]-5], d['coords'][columns[k2]-5],
             marker=marker,
             markersize=7,
             markeredgecolor='white',
             markeredgewidth=2,
             markerfacecolor=d['color'])
开发者ID:liquid-phynix,项目名称:mcstar-scripts,代码行数:11,代码来源:bond-order-analysis.py

示例9: test_contains_points_negative_radius

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
def test_contains_points_negative_radius():
    path = Path.unit_circle()

    points = [(0.0, 0.0), (1.25, 0.0), (0.9, 0.9)]
    expected = [True, False, False]
    result = path.contains_points(points, radius=-0.5)

    assert result.dtype == np.bool
    assert np.all(result == expected)
开发者ID:en9apr,项目名称:VM_Backup,代码行数:11,代码来源:test_path.py

示例10: elliptical_spine

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
def elliptical_spine(cls, axes, center, xrad, yrad, **kwargs):
    '''
    (staticmethod) Returns an elliptical :class: `Spine`.
    '''
    path = Path.unit_circle()
    spine_type = 'circle' # since aspect = 2 and axes rect is 0-1, 0-1
    result = cls(axes, spine_type, path, **kwargs)
    set_patch_ellipse(result, center, xrad, yrad)
    return result
开发者ID:amcmorl,项目名称:amcmorl-py-tools,代码行数:11,代码来源:split_lambert_projection.py

示例11: __init__

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
 def __init__(self, xy, radius, **kwargs):
     """
     xy : array_like
       center of two circles
     radius : scalar
       size of each circle
       
     Valid kwargs are:
     %(Patch)s
     """
     Patch.__init__(self, **kwargs)
     self.center = xy
     self.radius = radius
     self.width = 4. # two x unit circle (i.e. from +1 to -1)
     self.height = 2. # one x unit circle
     path = copy(Path.unit_circle())
     n_pts = path.vertices.shape[0]
     path.vertices = np.tile(path.vertices, [2,1])
     path.vertices[:n_pts,0] -= 1
     path.vertices[n_pts:,0] += 1
     path.codes = np.tile(path.codes, [2])
     self._path = path
     # Note: This cannot be calculated until this is added to an Axes
     self._patch_transform = transforms.IdentityTransform()
开发者ID:amcmorl,项目名称:amcmorl-py-tools,代码行数:26,代码来源:split_lambert_projection.py

示例12: _vertical_bar_path

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
    # but will then be redundant and should be removed.
    wedge_path.vertices[0] = 0
    wedge_path.vertices[-2:] = 0
    return wedge_path


CLOUD_COVER = {
    0: [_ring_path()],
    1: [_ring_path(), _vertical_bar_path()],
    2: [_ring_path(), _wedge_fix(Path.wedge(0, 90))],
    3: [_ring_path(), _wedge_fix(Path.wedge(0, 90)), _vertical_bar_path()],
    4: [_ring_path(), Path.unit_circle_righthalf()],
    5: [_ring_path(), Path.unit_circle_righthalf(), _left_bar_path()],
    6: [_ring_path(), _wedge_fix(Path.wedge(-180, 90))],
    7: [_slot_path()],
    8: [Path.unit_circle()],
    9: [_ring_path(), _slash_path(), _backslash_path()],
}
"""
A dictionary mapping WMO cloud cover codes to their corresponding symbol.

See http://www.wmo.int/pages/prog/www/DPFS/documents/485_Vol_I_en_colour.pdf
    Part II, Appendix II.4, Graphical Representation of Data, Analyses and Forecasts

"""


def _convert_paths_to_patches():
    # Convert the symbols defined as lists-of-paths into patches.
    for code, symbol in CLOUD_COVER.iteritems():
        CLOUD_COVER[code] = _make_merged_patch(symbol)
开发者ID:smbz,项目名称:iris,代码行数:33,代码来源:symbols.py

示例13: __init__

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
 def __init__(self, hatch, density):
     path = Path.unit_circle()
     self.shape_vertices = path.vertices
     self.shape_codes = path.codes
     Shapes.__init__(self, hatch, density)
开发者ID:4over7,项目名称:matplotlib,代码行数:7,代码来源:hatch.py

示例14: symbol

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
Specialized markers
"""


from matplotlib.path import Path
import numpy as np


"""The Earth symbol (circle and cross)."""
earth = Path.unit_circle()
verts = np.concatenate([earth.vertices, [[-1, 0], [1, 0], [0, -1], [0, 1]]])
codes = np.concatenate([earth.codes, [Path.MOVETO, Path.LINETO] * 2])
earth = Path(verts, codes)
del verts, codes


def reticle(inner=0.5, outer=1.0, angle=0.0):
    """
    Create a reticle (crosshairs) marker.

    Parameters
    ----------

    inner : float
        Distance from the origin to the inside of the crosshairs.
开发者ID:astrophysicsvivien,项目名称:lalsuite,代码行数:33,代码来源:marker.py

示例15: draw_circle

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import unit_circle [as 别名]
    return res

draw_map = {}


def draw_circle(ax, x, y, color, scale=0.1):
    path = Path(unit_circle.vertices * scale, unit_circle.codes)
    trans = matplotlib.transforms.Affine2D().translate(x, y)
    t_path = path.transformed(trans)
    patch = patches.PathPatch(t_path, facecolor=color.value, lw=line_weight, zorder=2)
    a = ax.add_patch(patch)
    ma = MonosaccharidePatch(saccharide_shape=(a,))
    return ma
    # return (a,)
draw_map[ResidueShape.circle] = draw_circle
unit_circle = Path.unit_circle()


def draw_square(ax, x, y, color, scale=0.1):
    square_verts = np.array([
        (0.5, 0.5),
        (0.5, -0.5),
        (-0.5, -0.5),
        (-0.5, 0.5),
        (0.5, 0.5),
        (0., 0.),
    ]) * 2
    square_codes = [
        Path.MOVETO,
        Path.LINETO,
        Path.LINETO,
开发者ID:BostonUniversityCBMS,项目名称:glypy,代码行数:33,代码来源:cfg_symbols.py


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