📜  matplotlib 测量文本的宽度 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:08.706000             🧑  作者: Mango

代码示例2
from matplotlib import pyplot as plt

f = plt.figure()
r = f.canvas.get_renderer()
t = plt.text(0.5, 0.5, 'test')

bb = t.get_window_extent(renderer=r)
width = bb.width
height = bb.height