當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。