title: How to bold and to break text in two line of plt.annotate [python]
body: <p>I calculated R-squared and the regression equation, and then plotted the graph, but my problem is:</p>
  
  <p>1) I can not write my text "plt.annotate" in two lines.</p>
  
  <p>2) I can not write ($R^2$) in bold</p>
  
  <p>here is my script:</p>
  
  <pre><code>import numpy as np 
  import matplotlib.pyplot as plt
  from pylab import *
  
  
  x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
  y = [1, 2, 2, 4, 5, 4, 6, 4, 6, 7, 9, 10, 11, 12, 15]
  
  
  n = len(x)
  x = np.array(x)
  y = np.array(y)
  sumx = sum(x)
  sumy = sum(y)
  sumx2 = sum(x*x)
  sumy2 = sum(y*y)
  sumxy = sum(x*y)
  promx = sumx/n
  promy = sumy/n
  
  m = (sumx*sumy - n*sumxy)/(sumx**2 - n*sumx2)
  b =  promy - m*promx
  
  sigmax = np.sqrt(sumx2/n - promx**2)
  sigmay = np.sqrt(sumy2/n - promy**2)
  sigmaxy = sumxy/n - promx*promy
  R2 = (sigmaxy/(sigmax*sigmay))**2
  
  print(m, b)
  print(R2)
  
  plt.plot(x, y,'bo', label='H1')
  plt.plot(x, m*x + b, 'r-')  
  plt.xlabel('x')
  plt.ylabel('y')
  #plt.grid()
  
  plt.annotate('y = ' + str(round(m,4)) + 'x + ' + str(round(b,4)) + ' ; ' + '$R^2$ = ' + str(round(R2,3)), xy=(1.2, 11.5), fontsize=12, fontweight="bold")
  
  
  plt.legend(loc=4)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/miqCP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/miqCP.png" alt="enter image description here"></a></p>
  
  <p>I hope the result should be like that :<br>
  <strong>y = 0.75x + 0.2<br>
  R^2 = 0.914</strong></p>