zsh2270365028的个人博客分享 http://blog.sciencenet.cn/u/zsh2270365028

博文

[转载]python Text watermark

已有 991 次阅读 2022-1-20 16:11 |个人分类:Python|系统分类:科研笔记|文章来源:转载

refer to: https://matplotlib.org/stable/gallery/text_labels_and_annotations/watermark_text.html#sphx-glr-gallery-text-labels-and-annotations-watermark-text-py


Text watermark

A watermark effect can be achieved by drawing a semi-transparent text.

import numpy as npimport matplotlib.pyplot as plt# Fixing random state for reproducibilitynp.random.seed(19680801)fig, ax = plt.subplots()ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange')ax.grid()ax.text(0.5, 0.5, 'created with matplotlib', transform=ax.transAxes,
        fontsize=40, color='gray', alpha=0.5,
        ha='center', va='center', rotation='30')plt.show()

watermark text

References

The use of the following functions, methods, classes and modules is shown in this example:

Download Python source code: watermark_text.py

Download Jupyter notebook: watermark_text.ipynb




https://m.sciencenet.cn/blog-587102-1321881.html

上一篇:[转载]STIX Fonts
下一篇:[转载]python Fonts demo (object-oriented style)

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-16 03:39

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部