Bold annotated text in matplotlib

I want to make annotated text in a plot using matplotlib. I tried the following:

a=10.0 font=matplotlib.font_manager.FontProperties() font.set_weight('bold') text(0,1,":.2f".format(a), fontproperties=font) 

I also tried:

  a=10.0 text(0,1,":.2f".format(a), weight='bold') 

None of them work.


minimal example:

 import matplotlib.pyplot as plt def main(): plt.figure() plt.plot([0,1],[0,1]) plt.text(0.5,0.5,"string",weight="bold") 

matplotlib version: 1.2.1

python 3.3.2

+5
source share

Source: https://habr.com/ru/post/1245574/


All Articles