當前位置: 首頁>>代碼示例>>Python>>正文


Python patheffects.withSimplePatchShadow方法代碼示例

本文整理匯總了Python中matplotlib.patheffects.withSimplePatchShadow方法的典型用法代碼示例。如果您正苦於以下問題:Python patheffects.withSimplePatchShadow方法的具體用法?Python patheffects.withSimplePatchShadow怎麽用?Python patheffects.withSimplePatchShadow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.patheffects的用法示例。


在下文中一共展示了patheffects.withSimplePatchShadow方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_patheffect3

# 需要導入模塊: from matplotlib import patheffects [as 別名]
# 或者: from matplotlib.patheffects import withSimplePatchShadow [as 別名]
def test_patheffect3():
    p1, = plt.plot([1, 3, 5, 4, 3], 'o-b', lw=4)
    p1.set_path_effects([path_effects.SimpleLineShadow(),
                         path_effects.Normal()])
    plt.title(r'testing$^{123}$',
        path_effects=[path_effects.withStroke(linewidth=1, foreground="r")])
    leg = plt.legend([p1], [r'Line 1$^2$'], fancybox=True, loc=2)
    leg.legendPatch.set_path_effects([path_effects.withSimplePatchShadow()])

    text = plt.text(2, 3, 'Drop test', color='white',
                    bbox={'boxstyle': 'circle,pad=0.1', 'color': 'red'})
    pe = [path_effects.Stroke(linewidth=3.75, foreground='k'),
          path_effects.withSimplePatchShadow((6, -3), shadow_rgbFace='blue')]
    text.set_path_effects(pe)
    text.get_bbox_patch().set_path_effects(pe)

    pe = [path_effects.PathPatchEffect(offset=(4, -4), hatch='xxxx',
                                       facecolor='gray'),
          path_effects.PathPatchEffect(edgecolor='white', facecolor='black',
                                       lw=1.1)]

    t = plt.gcf().text(0.02, 0.1, 'Hatch shadow', fontsize=75, weight=1000,
                       va='center')
    t.set_path_effects(pe) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:26,代碼來源:test_patheffects.py

示例2: test_patheffect3

# 需要導入模塊: from matplotlib import patheffects [as 別名]
# 或者: from matplotlib.patheffects import withSimplePatchShadow [as 別名]
def test_patheffect3():
    p1, = plt.plot([1, 3, 5, 4, 3], 'o-b', lw=4)
    p1.set_path_effects([path_effects.SimpleLineShadow(),
                         path_effects.Normal()])
    plt.title(r'testing$^{123}$',
        path_effects=[path_effects.withStroke(linewidth=1, foreground="r")])
    leg = plt.legend([p1], [r'Line 1$^2$'], fancybox=True, loc='upper left')
    leg.legendPatch.set_path_effects([path_effects.withSimplePatchShadow()])

    text = plt.text(2, 3, 'Drop test', color='white',
                    bbox={'boxstyle': 'circle,pad=0.1', 'color': 'red'})
    pe = [path_effects.Stroke(linewidth=3.75, foreground='k'),
          path_effects.withSimplePatchShadow((6, -3), shadow_rgbFace='blue')]
    text.set_path_effects(pe)
    text.get_bbox_patch().set_path_effects(pe)

    pe = [path_effects.PathPatchEffect(offset=(4, -4), hatch='xxxx',
                                       facecolor='gray'),
          path_effects.PathPatchEffect(edgecolor='white', facecolor='black',
                                       lw=1.1)]

    t = plt.gcf().text(0.02, 0.1, 'Hatch shadow', fontsize=75, weight=1000,
                       va='center')
    t.set_path_effects(pe) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:26,代碼來源:test_patheffects.py

示例3: plot_heatmap

# 需要導入模塊: from matplotlib import patheffects [as 別名]
# 或者: from matplotlib.patheffects import withSimplePatchShadow [as 別名]
def plot_heatmap(evaluators, store=True):
        mi_df = Evaluator.to_multi_index_frame(evaluators)
        detectors, datasets = mi_df.columns, mi_df.index

        fig, ax = plt.subplots(figsize=(len(detectors) + 2, len(datasets)))
        im = ax.imshow(mi_df, cmap=plt.get_cmap('YlOrRd'), vmin=0, vmax=1)
        plt.colorbar(im)

        # Show MultiIndex for ordinate
        Evaluator.insert_multi_index_yaxis(ax, mi_df)

        # Rotate the tick labels and set their alignment.
        ax.set_xticks(np.arange(len(detectors)))
        ax.set_xticklabels(detectors)
        plt.setp(ax.get_xticklabels(), rotation=45, ha='right', rotation_mode='anchor')

        # Loop over data dimensions and create text annotations.
        for i in range(len(detectors)):
            for j in range(len(datasets)):
                ax.text(i, j, f'{mi_df.iloc[j, i]:.2f}', ha='center', va='center', color='w',
                        path_effects=[path_effects.withSimplePatchShadow(
                            offset=(1, -1), shadow_rgbFace='b', alpha=0.9)])

        ax.set_title('AUROC over all datasets and detectors')
        # Prevent bug where x axis ticks are completely outside of bounds (matplotlib/issues/5456)
        if len(datasets) > 2:
            fig.tight_layout()
        if store:
            evaluators[0].store(fig, 'heatmap', no_counters=True, store_in_figures=True)
        return fig 
開發者ID:KDD-OpenSource,項目名稱:DeepADoTS,代碼行數:32,代碼來源:evaluator.py


注:本文中的matplotlib.patheffects.withSimplePatchShadow方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。