1""" 2=========== 3Broken Barh 4=========== 5 6Make a "broken" horizontal bar plot, i.e., one with gaps 7""" 8import matplotlib.pyplot as plt 9 10fig, ax = plt.subplots() 11ax.broken_barh([(110, 30), (150, 10)], (10, 9), facecolors='blue') 12ax.broken_barh([(10, 50), (100, 20), (130, 10)], (20, 9), 13 facecolors=('red', 'yellow', 'green')) 14ax.set_ylim(5, 35) 15ax.set_xlim(0, 200) 16ax.set_xlabel('seconds since start') 17ax.set_yticks([15, 25]) 18ax.set_yticklabels(['Bill', 'Jim']) 19ax.grid(True) 20ax.annotate('race interrupted', (61, 25), 21 xytext=(0.8, 0.9), textcoords='axes fraction', 22 arrowprops=dict(facecolor='black', shrink=0.05), 23 fontsize=16, 24 horizontalalignment='right', verticalalignment='top') 25 26plt.show() 27