Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 73f34bf

Browse files
committed
reorganization of style classes in patches.py
svn path=/trunk/matplotlib/; revision=6480
1 parent 561988f commit 73f34bf

4 files changed

Lines changed: 1474 additions & 982 deletions

File tree

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2008-12-02 The transmuter classes in the patches.py are reorganized as
2+
subclasses of the Style classes. A few more box and arrow
3+
styles are added. -JJL
4+
15
2008-12-02 Fixed a bug in the new legend class that didn't allowed
26
a tuple of coordinate vlaues as loc. -JJL
37

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import matplotlib.patches as mpatches
2+
import matplotlib.pyplot as plt
3+
4+
styles = mpatches.ArrowStyle.get_styles()
5+
6+
figheight = (len(styles)+.5)
7+
fig1 = plt.figure(1, (4, figheight))
8+
fontsize = 0.3 * fig1.dpi
9+
10+
ax = plt.Axes(fig1, [0, 0, 1, 1], frameon=False, aspect=1.)
11+
fig1.add_axes(ax)
12+
13+
ax.set_xlim(0, 4)
14+
ax.set_ylim(0, figheight)
15+
16+
for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
17+
y = (float(len(styles)) -0.25 - i) # /figheight
18+
p = mpatches.Circle((3.2, y), 0.2, fc="w")
19+
ax.add_patch(p)
20+
#ax.plot([0.8], [y], "o", mec="b", mfc="w", ms=20, transform=fig1.transFigure)
21+
#ax.scatter([0.8], [y], s=20*20, marker="o", edgecolors=["b"], facecolors=["w"],
22+
# )
23+
ax.annotate(stylename, (3.2, y),
24+
(2., y),
25+
#xycoords="figure fraction", textcoords="figure fraction",
26+
ha="right", va="center",
27+
size=fontsize,
28+
arrowprops=dict(arrowstyle=stylename,
29+
patchB=p,
30+
shrinkA=5,
31+
shrinkB=5,
32+
fc="w", ec="k",
33+
connectionstyle="arc3,rad=-0.05",
34+
),
35+
bbox=dict(boxstyle="square", fc="w"))
36+
37+
ax.xaxis.set_visible(False)
38+
ax.yaxis.set_visible(False)
39+
40+
41+
42+
plt.draw()
43+
plt.show()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import matplotlib.patches as mpatch
2+
import matplotlib.pyplot as plt
3+
4+
styles = mpatch.BoxStyle.get_styles()
5+
6+
figheight = (len(styles)+.5)
7+
fig1 = plt.figure(1, (4, figheight))
8+
fontsize = 0.4 * fig1.dpi
9+
10+
for i, (stylename, styleclass) in enumerate(styles.items()):
11+
fig1.text(0.5, (float(len(styles)) - 0.5 - i)/figheight, stylename,
12+
ha="center",
13+
size=fontsize,
14+
transform=fig1.transFigure,
15+
bbox=dict(boxstyle=stylename, fc="w", ec="k"))
16+
plt.draw()
17+
plt.show()

0 commit comments

Comments
 (0)