文本水印

水印效果可以通过绘制半透明文本来实现。

import numpy as np
import matplotlib.pyplot as plt

# Fixing random state for reproducibility
np.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

工具书类

以下函数、方法、类和模块的使用如本例所示:

出:

<function Figure.text at 0x7faa00cddea0>

关键词:matplotlib代码示例,codex,python plot,pyplot Gallery generated by Sphinx-Gallery