Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

ax text not placed correclty

import matplotlib.pyplot as plt

# Define some names and variables to go in the text box.
xn, yn, cod = 'r', 'p', 'abc'
prec = 2
ccl = [546.35642, 6785.35416]
ect = [12.5235, 13.643241]

fig = plt.figure()
ax = fig.add_subplot(111)
ax.axis([-1, 10, -1, 1])

# Generate text to write.
text1 = "${}_{{t}} = {:.{p}f} pm {:.{p}f}; {c}$".format(xn, ccl[0],
    ect[0], c=cod, p=prec)
text2 = "${}_{{t}} = {:.{p}f} pm {:.{p}f}; {c}$".format(yn, ccl[1],
    ect[1], c=cod, p=prec)
text = text1 + '
' + text2

ax.annotate(text, xy=(1, 1), xytext=(-15, -15), fontsize=10,
    xycoords='axes fraction', textcoords='offset points',
    bbox=dict(facecolor='white', alpha=0.8),
    horizontalalignment='right', verticalalignment='top')

plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: Find element with class name in requests-html python 
Python :: How to srape all links from a website in python 
Python :: python run docker interactively subprocess 
Python :: Python NumPy broadcast_arrays() Function Syntax 
Python :: Python NumPy atleast_2d Function Example 2 
Python :: Python NumPy moveaxis function Example 
Python :: jupyter extension 4 
Python :: text xml 
Python :: use fetchone() function to find duplicate row. 
Python :: Python NumPy asanyarray Function Example List to an array 
Python :: Python NumPy require Function Example without requirements attribute 
Python :: Python NumPy array_split Function Example 02 
Python :: TemplateDoesNotExist at / 
Python :: como saber si un string es un numero python 
Python :: __sub__ 
Python :: NumPy resize Example out of bound values [appending zeros] 
Python :: print number upto 2 decimal places in f string python 
Python :: NumPy right_shift Code When inputs and bit shift are an arrays 
Python :: data base creation 
Python :: Python matplotlib multiple bars 
Python :: how to change voice in pyttsx3 
Python :: python dependency injection 
Python :: combination in python without itertools 
Python :: write an empty block python 
Python :: Example 1: How isidentifier() works? 
Python :: python pyramid pattern 
Python :: python QFileDialog select files 
Python :: postgres fecth python 
Python :: protilipi get text python 
Python :: ring create an application to ask the user about his/her name. 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =