. 1 Import matplotlib.pyplot AS PLT 2 Import numpy AS NP . 3 np.random.seed (0) . 4 X = np.arange (. 5 ) . 5 Y np.random.randint = (-5,5,5 ) . 6 plt.subplot (1,2,1 ) . 7 plt.bar (X, Y, Color = ' blue ' ) . 8 # Add the blue line in the horizontal direction at a position 0 . 9 plt.axhline (0, Color = ' blue ' , as linewidth = 2 ) 10 . 11 plt.subplot (1,2,2 ) 12 is # Barh will be swapped x and y, the x-axis direction on end 13 is plt.barh (x, y, Color =' Red ' ) 14 # Add the red line at the vertical positions 0 15 plt.axvline (0, Color = ' Red ' , as linewidth = 2 ) 16 . 17 plt.show ()