billyduc
billyduc

Reputation: 712

Matplotlib - How to add multiple lines text box on the left y axis within a figure

I need to add Multiple lines text on the left y axis within a figure, I try legend and figtext() but it can not work well for me.

for example

a = 123   ----------------------
b = 456   ----------------------   
...       ----------------------
...       ----------------------
z = 789   ----------------------

the dash lines is my axes, axes is bigger than textbox

Upvotes: 1

Views: 3027

Answers (1)

ev-br
ev-br

Reputation: 26090

#!/usr/bin/python
import matplotlib.pyplot as plt
from matplotlib import rc

plt.plot([1,2,3],[2,3,4],'ro-')

plt.text(0.5,2,'$a=3$\n$b=2$',fontsize=32)

plt.show()

Also look up annotate which in some cases is easier to work with.

Upvotes: 1

Related Questions