python - Matplotlib absolute text positioning -


i making movies matplotlib plots , have been struggling absolute positioning of text() elements. problem text blocks, typically increasing numbers, keep moving around depending on numbers printed. happens when set horizontal/vertical alignment fixed level (e.g. right or bottom).

this seems related use of latex fonts, in particular fonts characters wider others. default font (bitstream vera sans) not happen.

here illustration of problem. default font:

enter image description here

with latex cmbright font:

enter image description here

notice how position of decimal point shifts horizontally depending if leading digit 0, 1, or 2. in other examples decimal point shifts vertically. following code used produce these plots:

figure(figsize=(4,4)) tt = text(.7, .5, '00.0', va='center', ha='right', fontsize=60) in range(26):     tt.set_text('%04.1f' % (float(i)))     savefig(...) 

for latex font loaded following before:

rc('text', usetex=true) rc('text.latex', preamble=r'\usepackage{cmbright}') 

i have tried different types of alignment, still can't point fixed. ha='right' thought right side @ fixed location. changing font not option, need 1 consistency , other reasons. ideas on how fix problem? leads unprofessional-looking videos.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -