Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add an extra information in a python plot?

Suppose we have a figure with three plots in it for three different parameters. But for the all three plots We have same temperature T=4K . Then how can I add this information in the figure?

I am not interested to write it in the Caption. I want it on the figure itself.

like image 293
user22180 Avatar asked Apr 17 '13 17:04

user22180


People also ask

How do you add information to a plot in Python?

text() is the main function we can use to add text to a plot. We start by adding the string “function” with fontsize=12 to the location (10, 20). By default, the location is given in data coordinates. The coordinate system can be changed using the transform parameter.


1 Answers

figtext would work well.

The advantage of figtext over text and annotate is that figtext defaults to using the figure coordinates, whereas the others default to using the coordinates of the axes (and therefore "T=4K" would move around if your axes are different between the different plots).

import matplotlib.pyplot as plt

plt.figure()
plt.xlim(-10, 10)
plt.ylim(0, .01)
plt.figtext(.8, .8, "T = 4K")
plt.show()

enter image description here

like image 162
tom10 Avatar answered Oct 21 '22 08:10

tom10