Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

matplotlib measure the width of text

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #matplotlib #measure #width #text
ADD COMMENT
Topic
Name
3+7 =