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

Skip to content

Commit 520ee75

Browse files
committed
use plain text rather than text image for watermark example
svn path=/trunk/matplotlib/; revision=5670
1 parent 4d11bf4 commit 520ee75

2 files changed

Lines changed: 18 additions & 23 deletions

File tree

doc/devel/release_guide.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,17 @@ Uploading
5555

5656
* ftp the source and binaries to the anonymous FTP site::
5757

58-
local> cd dist
59-
local> ncftp upload.sourceforge.net
60-
ncftp> cd incoming
61-
ncftp> put tar.gz, zip exe
58+
mpl> svn-clean
59+
mpl> python setup.py sdist
60+
mpl> cd dist/
61+
dist> sftp [email protected]
62+
Connecting to frs.sourceforge.net...
63+
sftp> cd uploads
64+
sftp> ls
65+
sftp> lls
66+
matplotlib-0.98.2.tar.gz
67+
sftp> put matplotlib-0.98.2.tar.gz
68+
Uploading matplotlib-0.98.2.tar.gz to /incoming/j/jd/jdh2358/uploads/matplotlib-0.98.2.tar.gz
6269

6370
* go https://sourceforge.net/project/admin/?group_id=80706 and do a
6471
file release. Click on the "Admin" tab to log in as an admin, and

examples/api/watermark_text.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,22 @@
11
"""
2-
Use a PNG file as a watermark
2+
Use a Text as a watermark
33
"""
44
import numpy as np
55
import matplotlib
66
matplotlib.use('Agg')
77

8-
import matplotlib.mathtext as mathtext
98
import matplotlib.pyplot as plt
10-
import matplotlib
11-
matplotlib.rc('image', origin='upper')
12-
13-
dpi = 100 # save dpi
14-
w, h = 8, 6 # inches
15-
16-
parser = mathtext.MathTextParser("Bitmap")
179

18-
rgba, depth1 = parser.to_rgba(r'Property of MPL', color='gray',
19-
fontsize=30, dpi=200)
20-
rgba[:,:,-1] *= 0.5
21-
fig = plt.figure(figsize=(w,h))
10+
fig = plt.figure()
2211

2312
ax = fig.add_subplot(111)
2413
ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange')
2514
ax.grid()
2615

27-
imh, imw, tmp = rgba.shape
28-
29-
# position image at bottom right
30-
fig.figimage(rgba.astype(float)/255., w*dpi-imw, 0)
31-
16+
# position bottom right
17+
fig.text(0.95, 0.05, 'Property of MPL',
18+
fontsize=50, color='gray',
19+
ha='right', va='bottom', alpha=0.5)
3220

33-
fig.savefig('watermarked_text', transparent=True, dpi=dpi)
21+
fig.savefig('watermarked_text', transparent=True)
3422

0 commit comments

Comments
 (0)