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


Python markers.MarkerStyle方法代码示例

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


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

示例1: plot_latent_distribution

# 需要导入模块: from matplotlib import markers [as 别名]
# 或者: from matplotlib.markers import MarkerStyle [as 别名]
def plot_latent_distribution(encoder,
                             x_test,
                             y_test,
                             batch_size=128):
    """
    Display a 2D plot of the digit classes in the latent space.
    We are interested only in z, so we only need the encoder here.
    :param encoder: the encoder network
    :param x_test: test images
    :param y_test: test labels
    :param batch_size: size of the mini-batch
    """
    z_mean, _, _ = encoder.predict(x_test, batch_size=batch_size)
    plt.figure(figsize=(6, 6))

    markers = ('o', 'x', '^', '<', '>', '*', 'h', 'H', 'D', 'd', 'P', 'X', '8', 's', 'p')

    for i in np.unique(y_test):
        plt.scatter(z_mean[y_test == i, 0], z_mean[y_test == i, 1],
                    marker=MarkerStyle(markers[i], fillstyle='none'),
                    edgecolors='black')

    plt.xlabel("z[0]")
    plt.ylabel("z[1]")
    plt.show() 
开发者ID:ivan-vasilev,项目名称:Python-Deep-Learning-SE,代码行数:27,代码来源:chapter_06_001.py

示例2: get_marker_style

# 需要导入模块: from matplotlib import markers [as 别名]
# 或者: from matplotlib.markers import MarkerStyle [as 别名]
def get_marker_style(line):
    """Get the style dictionary for matplotlib marker objects"""
    style = {}
    style['alpha'] = line.get_alpha()
    if style['alpha'] is None:
        style['alpha'] = 1

    style['facecolor'] = export_color(line.get_markerfacecolor())
    style['edgecolor'] = export_color(line.get_markeredgecolor())
    style['edgewidth'] = line.get_markeredgewidth()

    style['marker'] = line.get_marker()
    markerstyle = MarkerStyle(line.get_marker())
    markersize = line.get_markersize()
    markertransform = (markerstyle.get_transform()
                       + Affine2D().scale(markersize, -markersize))
    style['markerpath'] = SVG_path(markerstyle.get_path(),
                                   markertransform)
    style['markersize'] = markersize
    style['zorder'] = line.get_zorder()
    return style 
开发者ID:mpld3,项目名称:mplexporter,代码行数:23,代码来源:utils.py

示例3: test_scatter_marker

# 需要导入模块: from matplotlib import markers [as 别名]
# 或者: from matplotlib.markers import MarkerStyle [as 别名]
def test_scatter_marker(self):
        fig, (ax0, ax1, ax2) = plt.subplots(ncols=3)
        ax0.scatter([3, 4, 2, 6], [2, 5, 2, 3],
                    c=[(1, 0, 0), 'y', 'b', 'lime'],
                    s=[60, 50, 40, 30],
                    edgecolors=['k', 'r', 'g', 'b'],
                    marker='s')
        ax1.scatter([3, 4, 2, 6], [2, 5, 2, 3],
                    c=[(1, 0, 0), 'y', 'b', 'lime'],
                    s=[60, 50, 40, 30],
                    edgecolors=['k', 'r', 'g', 'b'],
                    marker=mmarkers.MarkerStyle('o', fillstyle='top'))
        # unit area ellipse
        rx, ry = 3, 1
        area = rx * ry * np.pi
        theta = np.linspace(0, 2 * np.pi, 21)
        verts = np.column_stack([np.cos(theta) * rx / area,
                                 np.sin(theta) * ry / area])
        ax2.scatter([3, 4, 2, 6], [2, 5, 2, 3],
                    c=[(1, 0, 0), 'y', 'b', 'lime'],
                    s=[60, 50, 40, 30],
                    edgecolors=['k', 'r', 'g', 'b'],
                    marker=verts) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:25,代码来源:test_axes.py

示例4: get_marker_style

# 需要导入模块: from matplotlib import markers [as 别名]
# 或者: from matplotlib.markers import MarkerStyle [as 别名]
def get_marker_style(line):
    """Get the style dictionary for matplotlib marker objects"""
    style = {}
    style['alpha'] = line.get_alpha()
    if style['alpha'] is None:
        style['alpha'] = 1

    style['facecolor'] = color_to_hex(line.get_markerfacecolor())
    style['edgecolor'] = color_to_hex(line.get_markeredgecolor())
    style['edgewidth'] = line.get_markeredgewidth()

    style['marker'] = line.get_marker()
    markerstyle = MarkerStyle(line.get_marker())
    markersize = line.get_markersize()
    markertransform = (markerstyle.get_transform()
                       + Affine2D().scale(markersize, -markersize))
    style['markerpath'] = SVG_path(markerstyle.get_path(),
                                   markertransform)
    style['markersize'] = markersize
    style['zorder'] = line.get_zorder()
    return style 
开发者ID:jeanfeydy,项目名称:lddmm-ot,代码行数:23,代码来源:utils.py

示例5: test_scatter_marker

# 需要导入模块: from matplotlib import markers [as 别名]
# 或者: from matplotlib.markers import MarkerStyle [as 别名]
def test_scatter_marker():
    fig, (ax0, ax1, ax2) = plt.subplots(ncols=3)
    ax0.scatter([3, 4, 2, 6], [2, 5, 2, 3],
                c=[(1, 0, 0), 'y', 'b', 'lime'],
                s=[60, 50, 40, 30],
                edgecolors=['k', 'r', 'g', 'b'],
                marker='s')
    ax1.scatter([3, 4, 2, 6], [2, 5, 2, 3],
                c=[(1, 0, 0), 'y', 'b', 'lime'],
                s=[60, 50, 40, 30],
                edgecolors=['k', 'r', 'g', 'b'],
                marker=mmarkers.MarkerStyle('o', fillstyle='top'))
    # unit area ellipse
    rx, ry = 3, 1
    area = rx * ry * np.pi
    theta = np.linspace(0, 2 * np.pi, 21)
    verts = np.column_stack([np.cos(theta) * rx / area,
                             np.sin(theta) * ry / area])
    ax2.scatter([3, 4, 2, 6], [2, 5, 2, 3],
                c=[(1, 0, 0), 'y', 'b', 'lime'],
                s=[60, 50, 40, 30],
                edgecolors=['k', 'r', 'g', 'b'],
                verts=verts) 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:25,代码来源:test_axes.py

示例6: test_marker_styles

# 需要导入模块: from matplotlib import markers [as 别名]
# 或者: from matplotlib.markers import MarkerStyle [as 别名]
def test_marker_styles():
    fig = plt.figure()
    ax = fig.add_subplot(111)
    for y, marker in enumerate(sorted(matplotlib.markers.MarkerStyle.markers,
                                      key=lambda x: str(type(x))+str(x))):
        ax.plot((y % 2)*5 + np.arange(10)*10, np.ones(10)*10*y, linestyle='',
                marker=marker, markersize=10+y/5, label=marker) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:9,代码来源:test_axes.py

示例7: test_markers_valid

# 需要导入模块: from matplotlib import markers [as 别名]
# 或者: from matplotlib.markers import MarkerStyle [as 别名]
def test_markers_valid():
    marker_style = markers.MarkerStyle()
    mrk_array = np.array([[-0.5, 0],
                          [0.5, 0]])
    # Checking this doesn't fail.
    marker_style.set_marker(mrk_array) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:8,代码来源:test_marker.py

示例8: test_markers_invalid

# 需要导入模块: from matplotlib import markers [as 别名]
# 或者: from matplotlib.markers import MarkerStyle [as 别名]
def test_markers_invalid():
    marker_style = markers.MarkerStyle()
    mrk_array = np.array([[-0.5, 0, 1, 2, 3]])
    # Checking this does fail.
    with pytest.raises(ValueError):
        marker_style.set_marker(mrk_array) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:8,代码来源:test_marker.py

示例9: test_marker_path

# 需要导入模块: from matplotlib import markers [as 别名]
# 或者: from matplotlib.markers import MarkerStyle [as 别名]
def test_marker_path():
    marker_style = markers.MarkerStyle()
    path = Path([[0, 0], [1, 0]], [Path.MOVETO, Path.LINETO])
    # Checking this doesn't fail.
    marker_style.set_marker(path) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:7,代码来源:test_marker.py


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