Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e6b37ad

Browse filesBrowse files
committed
Add example code for current logo
1 parent 44fe937 commit e6b37ad
Copy full SHA for e6b37ad

File tree

Expand file treeCollapse file tree

1 file changed

+81
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+81
-0
lines changed

‎examples/misc/logos2.py

Copy file name to clipboardExpand all lines: examples/misc/logos2.py
+81Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,87 @@
88
Thanks to Tony Yu <tsyu80@gmail.com> for the logo design
99
"""
1010

11+
12+
import numpy as np
13+
import matplotlib as mpl
14+
import matplotlib.pyplot as plt
15+
import matplotlib.cm as cm
16+
17+
18+
def make_logo(figsize, lw_bars, lw_grid, lw_border, rgrid):
19+
mpl_blue = '#11557c'
20+
21+
with plt.rc_context(
22+
{'axes.edgecolor': mpl_blue, 'axes.linewidth': lw_border}):
23+
fig = plt.figure(figsize=figsize, dpi=100)
24+
fig.patch.set_alpha(0)
25+
26+
ax = fig.add_subplot(111, projection='polar')
27+
ax.set_axisbelow(True)
28+
29+
N = 7
30+
arc = 2. * np.pi
31+
theta = np.arange(0.0, arc, arc / N)
32+
radii = np.array([2, 6, 8, 7, 4, 5, 8])
33+
width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3])
34+
bars = ax.bar(theta, radii, width=width, bottom=0.0,
35+
edgecolor=mpl_blue, lw=lw_bars)
36+
for r, bar in zip(radii, bars):
37+
bar.set_facecolor(cm.jet(r / 10.))
38+
bar.set_alpha(0.6)
39+
40+
ax.tick_params(labelbottom=False, labeltop=False,
41+
labelleft=False, labelright=False)
42+
43+
ax.grid(lw=lw_grid, ls='-', color='0.7')
44+
ax.set_rlim(top=9)
45+
ax.set_yticks(rgrid)
46+
47+
fig.tight_layout(pad=0)
48+
return fig, ax
49+
50+
51+
params_large = {
52+
'figsize': (3, 3),
53+
'lw_bars': 2,
54+
'lw_grid': 0.8,
55+
'lw_border': 3,
56+
'rgrid': np.arange(1, 9, 2),
57+
}
58+
fig, ax = make_logo(**params_large)
59+
plt.savefig('logo_large.png')
60+
61+
##############################################################################
62+
63+
params_medium = {
64+
'figsize': (1, 1),
65+
'lw_bars': 0.5,
66+
'lw_grid': 0.5,
67+
'lw_border': 1,
68+
'rgrid': [3, 6],
69+
}
70+
71+
make_logo(**params_medium)
72+
plt.savefig('logo_small.png')
73+
74+
##############################################################################
75+
76+
params_xsmall = {
77+
'figsize': (.32, .32),
78+
'lw_bars': 0.3,
79+
'lw_grid': 0.3,
80+
'lw_border': 0.3,
81+
'rgrid': [5],
82+
}
83+
84+
make_logo(**params_xsmall)
85+
plt.savefig('logo_xsmall.png')
86+
87+
##############################################################################
88+
#
89+
# Old stuff
90+
# """""""""
91+
1192
import numpy as np
1293
import matplotlib as mpl
1394
import matplotlib.pyplot as plt

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.