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

Skip to content

Commit 9532c72

Browse files
committed
use generated logo in cheatsheets
1 parent 5eac537 commit 9532c72

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
make -C fonts/
4545
cp -r fonts/ /usr/share/fonts/
4646
fc-cache
47-
make figures cheatsheets handouts
47+
make all
4848
- name: Check layouts
4949
run: |
5050
set -x

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ SRC := $(wildcard *.tex)
44
default: all
55

66
.PHONY: all
7-
all: figures cheatsheets
7+
all: logos figures cheatsheets handouts
8+
9+
.PHONY: logos
10+
logos:
11+
cd logos && python mpl-logos2.py && pdfcrop mpl-logo2.pdf mpl-logo2.pdf
812

913
.PHONY: figures
1014
figures:
@@ -31,6 +35,7 @@ fonts:
3135

3236
.PHONY: clean
3337
clean: $(SRC)
38+
- rm ./logos/mpl-logo2.pdf
3439
git clean -f -X ./figures/
3540
git clean -f ./scripts/*.pdf
3641
latexmk -c $^

cheatsheets.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261

262262
\begin{multicols*}{5}
263263

264-
\includegraphics[width=\columnwidth]{matplotlib.pdf}
264+
\includegraphics[width=\columnwidth]{mpl-logo2.pdf}
265265
%\textbf{\Large \RobotoCon Matplotlib 3.2 cheat sheet}\\
266266
%{\ttfamily https://matplotlib.org} \hfill CC-BY 4.0
267267
% \bigskip

logos/mpl-logos2.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,27 @@ def create_text_axes(fig, height_px):
9797
path = TextPath((0, 0), "matplotlib", size=height_px * 0.8,
9898
prop=get_font_properties())
9999

100+
fp = get_font_properties()
101+
fp.set_weight('light')
102+
path1 = TextPath((80, -13), 'Cheat sheet', size=height_px * 0.12,
103+
prop=fp)
104+
path2 = TextPath((310, -13), f'Version {matplotlib. __version__}',
105+
size=height_px * 0.12,
106+
prop=fp)
107+
100108
angle = 4.25 # degrees
101109
trans = mtrans.Affine2D().skew_deg(angle, 0)
102110

103111
patch = PathPatch(path, transform=trans + ax.transData, color=MPL_BLUE,
104112
lw=0)
113+
patch1 = PathPatch(path1, transform=trans + ax.transData, color=MPL_BLUE,
114+
lw=0)
115+
patch2 = PathPatch(path2, color=MPL_BLUE,
116+
lw=0)
117+
105118
ax.add_patch(patch)
119+
ax.add_patch(patch1)
120+
ax.add_patch(patch2)
106121
ax.autoscale()
107122

108123

@@ -136,6 +151,8 @@ def make_logo(height_px, lw_bars, lw_grid, lw_border, rgrid, with_text=False):
136151
ax_pos = (0.535, 0.12, .17, 0.75) if with_text else (0.03, 0.03, .94, .94)
137152
ax = create_icon_axes(fig, ax_pos, lw_bars, lw_grid, lw_border, rgrid)
138153

154+
fig.savefig('mpl-logo2.pdf')
155+
139156
return fig, ax
140157

141158
##############################################################################
@@ -154,4 +171,4 @@ def make_logo(height_px, lw_bars, lw_grid, lw_border, rgrid, with_text=False):
154171

155172
make_logo(height_px=110, lw_bars=0.7, lw_grid=0.5, lw_border=1,
156173
rgrid=[1, 3, 5, 7], with_text=True)
157-
plt.show()
174+
# plt.show()

0 commit comments

Comments
 (0)