/usr/share/pyshared/matplotlib/tests/test_patheffects.py is in python-matplotlib 1.3.1-1ubuntu5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | import numpy as np
from matplotlib.testing.decorators import image_comparison
import matplotlib.pyplot as plt
from matplotlib.patheffects import (Normal, Stroke, withStroke,
withSimplePatchShadow)
@image_comparison(baseline_images=['patheffect1'], remove_text=True)
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=[withStroke(linewidth=3,
foreground="w")])
txt.arrow_patch.set_path_effects([Stroke(linewidth=5,
foreground="w"),
Normal()])
ax1.grid(True, linestyle="-")
pe = [withStroke(linewidth=3, foreground="w")]
for l in ax1.get_xgridlines() + ax1.get_ygridlines():
l.set_path_effects(pe)
@image_comparison(baseline_images=['patheffect2'], remove_text=True)
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=[withStroke(linewidth=3, foreground="w")])
clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True)
plt.setp(clbls,
path_effects=[withStroke(linewidth=3, foreground="w")])
@image_comparison(baseline_images=['patheffect3'])
def test_patheffect3():
ax3 = plt.subplot(111)
p1, = ax3.plot([0, 1], [0, 1])
ax3.set_title(r'testing$^{123}$',
path_effects=[withStroke(linewidth=1, foreground="r")])
leg = ax3.legend([p1], [r'Line 1$^2$'], fancybox=True, loc=2)
leg.legendPatch.set_path_effects([withSimplePatchShadow()])
if __name__ == '__main__':
import nose
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)
|