课程评价 (0)

请对课程作出评价:
0/300

学员评价

暂无精选评价
10分钟

path effect

4. 我们可以在基于PathArtist上应用drop-shadow effect(下沉效果)。如可以在filled patch Artist上应用matplotlib.patheffects.SimplePatchShadow,在line patch Artist上应用matplotlib.patheffects.SimpleLineShadow

你可以通过path_effects=[path_effects.with*()]来指定path_effects参数,或者直接通过path_effects=[path_effects.SimpleLineShadow(),path_effects.Normal()]来指定path_effects参数。

  • 前者会自动地在normal effect后跟随指定的effect
  • 后者会显式的指定effect

5.Strok effect可以用于制作出stand-out effect(突出效果)。

6. PathPatchEffect是一个通用的path effect类。如果对某个PathPatch设置了PathPatchEffect,则该effect.draw_path(...)方法执行的是由初始PathPatch计算的得到的一个新的PathPatch。 与一般的effect类不同,PathPatchEffect类的关键字参数是与PathPatch一致的,因为除了offset关键字参数外,其他的任何关键字参数都会传递给PathPatch构造函数。如:  import matplotlib.pyplot as plt  import matplotlib.patheffects as path_effects  fig = plt.figure(figsize=(8, 1))  t = fig.text(0.02, 0.5, 'Hatch shadow', fontsize=75, weight=1000, va='center')  t.set_path_effects([path_effects.PathPatchEffect(offset=(4, -4), hatch='xxxx',  facecolor='gray'),  path_effects.PathPatchEffect(edgecolor='white', linewidth=1.1,  facecolor='black')])  plt.show()