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


Python patheffects.withStroke方法代码示例

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


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

示例1: test_patheffect1

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def test_patheffect1():
    ax1 = plt.subplot(111)
    ax1.imshow([[1, 2], [2, 3]])
    txt = ax1.annotate("test", (1., 1.), (0., 0),
                       arrowprops=dict(arrowstyle="->",
                                       connectionstyle="angle3", lw=2),
                       size=20, ha="center",
                       path_effects=[path_effects.withStroke(linewidth=3,
                                                             foreground="w")])
    txt.arrow_patch.set_path_effects([path_effects.Stroke(linewidth=5,
                                                          foreground="w"),
                                      path_effects.Normal()])

    ax1.grid(True, linestyle="-")

    pe = [path_effects.withStroke(linewidth=3, foreground="w")]
    for l in ax1.get_xgridlines() + ax1.get_ygridlines():
        l.set_path_effects(pe) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:20,代码来源:test_patheffects.py

示例2: test_patheffect3

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [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

示例3: test_collection

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def test_collection():
    x, y = np.meshgrid(np.linspace(0, 10, 150), np.linspace(-5, 5, 100))
    data = np.sin(x) + np.cos(y)
    cs = plt.contour(data)
    pe = [path_effects.PathPatchEffect(edgecolor='black', facecolor='none',
                                       linewidth=12),
          path_effects.Stroke(linewidth=5)]

    for collection in cs.collections:
        collection.set_path_effects(pe)

    for text in plt.clabel(cs, colors='white'):
        text.set_path_effects([path_effects.withStroke(foreground='k',
                                                       linewidth=3)])
        text.set_bbox({'boxstyle': 'sawtooth', 'facecolor': 'none',
                       'edgecolor': 'blue'}) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:18,代码来源:test_patheffects.py

示例4: test_patheffect3

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [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

示例5: _add_inner_title

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def _add_inner_title(self, ax, title, loc, size=None, **kwargs):
        if size is None:
            size = dict(size=pp.rcParams['legend.fontsize'])
        at = AnchoredText(
            title, loc=loc, prop=size, pad=0., borderpad=0.5, frameon=False,
            **kwargs
        )
        at.set_zorder(200)
        ax.add_artist(at)
        at.txt._text.set_path_effects(
            [withStroke(foreground="w", linewidth=3)]
        )
        return at 
开发者ID:jantman,项目名称:python-wifi-survey-heatmap,代码行数:15,代码来源:heatmap.py

示例6: autolabel

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def autolabel(plt, fmt='%.2f'):
    rects = plt.patches
    ax = rects[0].axes
    y_bottom, y_top = ax.get_ylim()
    y_height = y_top - y_bottom
    for rect in rects:
        height = rect.get_height()
        if height / y_height > 0.95:
            label_position = height - (y_height * 0.06)
        else:
            label_position = height + (y_height * 0.01)
        txt = ax.text(rect.get_x() + rect.get_width()/2., label_position,
                fmt % height, ha='center', va='bottom')
        txt.set_path_effects([PathEffects.withStroke(linewidth=3, foreground='w')]) 
开发者ID:PacktPublishing,项目名称:Deep-Learning-for-Computer-Vision,代码行数:16,代码来源:utils.py

示例7: test_patheffect2

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def test_patheffect2():

    ax2 = plt.subplot(111)
    arr = np.arange(25).reshape((5, 5))
    ax2.imshow(arr)
    cntr = ax2.contour(arr, colors="k")

    plt.setp(cntr.collections,
             path_effects=[path_effects.withStroke(linewidth=3,
                                                   foreground="w")])

    clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True)
    plt.setp(clbls,
             path_effects=[path_effects.withStroke(linewidth=3,
                                                   foreground="w")]) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:17,代码来源:test_patheffects.py

示例8: circle

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def circle(x, y, radius=0.15):
    from matplotlib.patches import Circle
    from matplotlib.patheffects import withStroke
    circle = Circle((x, y), radius, clip_on=False, zorder=10, linewidth=1,
                    edgecolor='black', facecolor=(0, 0, 0, .0125),
                    path_effects=[withStroke(linewidth=5, foreground='w')])
    ax.add_artist(circle) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:9,代码来源:anatomy.py

示例9: add_inner_title

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def add_inner_title(ax, title, loc, size=None, **kwargs):
    from matplotlib.offsetbox import AnchoredText
    from matplotlib.patheffects import withStroke
    if size is None:
        size = dict(size=plt.rcParams['legend.fontsize'])
    at = AnchoredText(title, loc=loc, prop=size,
                      pad=0., borderpad=0.5,
                      frameon=False, **kwargs)
    ax.add_artist(at)
    at.txt._text.set_path_effects([withStroke(foreground="w", linewidth=3)])
    return at 
开发者ID:holzschu,项目名称:python3_ios,代码行数:13,代码来源:demo_axes_grid2.py

示例10: test_patheffect1

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def test_patheffect1():
    ax1 = plt.subplot(111)
    ax1.imshow([[1, 2], [2, 3]])
    txt = ax1.annotate("test", (1., 1.), (0., 0),
                       arrowprops=dict(arrowstyle="->",
                                       connectionstyle="angle3", lw=2),
                       size=20, ha="center",
                       path_effects=[path_effects.withStroke(linewidth=3,
                                                             foreground="w")])
    txt.arrow_patch.set_path_effects([path_effects.Stroke(linewidth=5,
                                                          foreground="w"),
                                      path_effects.Normal()])

    pe = [path_effects.withStroke(linewidth=3, foreground="w")]
    ax1.grid(True, linestyle="-", path_effects=pe) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:17,代码来源:test_patheffects.py

示例11: test_patheffects

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def test_patheffects():
    with matplotlib.rc_context():
        matplotlib.rcParams['path.effects'] = [
            patheffects.withStroke(linewidth=4, foreground='w')]
        fig, ax = plt.subplots()
        ax.plot([1, 2, 3])
        with io.BytesIO() as ps:
            fig.savefig(ps, format='ps') 
开发者ID:holzschu,项目名称:python3_ios,代码行数:10,代码来源:test_backend_ps.py

示例12: draw_prediction_info

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def draw_prediction_info(ax, x, y,
                         pred_obj,
                         pred_class_idx,
                         pred_box_2d,
                         ground_truth,
                         draw_score,
                         draw_iou,
                         gt_classes):

    label = ""

    if draw_score:
        label += "{:.2f}".format(pred_obj.score)

    if draw_iou and len(ground_truth) > 0:
        if draw_score:
            label += ', '
        iou = evaluation.two_d_iou(pred_box_2d, ground_truth)
        label += "{:.3f}".format(max(iou))

    box_cls = gt_classes[int(pred_class_idx)]

    ax.text(x, y - 4,
            gt_classes[int(pred_class_idx)] + '\n' + label,
            verticalalignment='bottom',
            horizontalalignment='center',
            color=BOX_COLOUR_SCHEME[box_cls],
            fontsize=10,
            fontweight='bold',
            path_effects=[
                patheffects.withStroke(linewidth=2,
                                       foreground='black')]) 
开发者ID:kujason,项目名称:avod,代码行数:34,代码来源:show_predictions_2d.py

示例13: __init__

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def __init__(self, base_size=12, scale=1, length=100, randomness=2,
                 stroke_size=4, stroke_color='white'):
        theme_gray.__init__(self, base_size)
        self.add_theme(
            theme(
                text=element_text(
                    family=['xkcd', 'Humor Sans', 'Comic Sans MS']),
                axis_ticks=element_line(color='black', size=1.5),
                axis_ticks_minor=element_blank(),
                axis_ticks_direction='in',
                axis_ticks_length_major=6,
                legend_background=element_rect(
                    color='black', fill='None'),
                legend_key=element_rect(fill='None'),
                panel_border=element_rect(color='black', size=1.5),
                panel_grid=element_blank(),
                panel_background=element_rect(fill='white'),
                strip_background=element_rect(
                    color='black', fill='white'),
                strip_background_x=element_rect(width=2/3.),
                strip_background_y=element_rect(height=2/3.),
                strip_margin=-0.5,
            ),
            inplace=True)

        d = {'axes.unicode_minus': False,
             'path.sketch':  (scale, length, randomness),
             'path.effects':  [
                 patheffects.withStroke(
                     linewidth=stroke_size,
                     foreground=stroke_color)]
             }
        self._rcParams.update(d) 
开发者ID:has2k1,项目名称:plotnine,代码行数:35,代码来源:theme_xkcd.py

示例14: drawBT

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def drawBT(self):
        if self.timex is not None and self.stemp2 is not None:
            self.l_temp2, = self.aw.qmc.ax.plot(self.timex,self.stemp2,transform=self.getTempTrans(),markersize=self.aw.qmc.BTmarkersize,marker=self.aw.qmc.BTmarker,visible=(self.visible and self.aligned),
                sketch_params=None,path_effects=[PathEffects.withStroke(linewidth=self.aw.qmc.BTlinewidth+self.aw.qmc.patheffects,foreground=self.aw.qmc.palette["background"])],
                linewidth=self.aw.qmc.BTlinewidth,linestyle=self.aw.qmc.BTlinestyle,drawstyle=self.aw.qmc.BTdrawstyle,
                alpha=(self.alpha[0] if self.active else self.alpha[0]*self.alpha_dim_factor),
                color=(self.color if self.active else self.gray),
                label="{} {}".format(self.label,self.aw.arabicReshape(QApplication.translate("Label", "BT", None)))) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:10,代码来源:comparator.py

示例15: drawET

# 需要导入模块: from matplotlib import patheffects [as 别名]
# 或者: from matplotlib.patheffects import withStroke [as 别名]
def drawET(self):
        if self.timex is not None and self.stemp1 is not None:
            self.l_temp1, = self.aw.qmc.ax.plot(self.timex,self.stemp1,transform=self.getTempTrans(),markersize=self.aw.qmc.ETmarkersize,marker=self.aw.qmc.ETmarker,visible=(self.visible and self.aligned),
                sketch_params=None,path_effects=[PathEffects.withStroke(linewidth=self.aw.qmc.ETlinewidth+self.aw.qmc.patheffects,foreground=self.aw.qmc.palette["background"])],
                linewidth=self.aw.qmc.ETlinewidth,linestyle=self.aw.qmc.ETlinestyle,drawstyle=self.aw.qmc.ETdrawstyle,
                alpha=(self.alpha[1] if self.active else self.alpha[1]*self.alpha_dim_factor),
                color=(self.color if self.active else self.gray),
                label="{} {}".format(self.label,self.aw.arabicReshape(QApplication.translate("Label", "ET", None)))) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:10,代码来源:comparator.py


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